上一页 1 2 3 4 5 6 7 8 9 ··· 24 下一页
摘要: #include #include #include #include #include using namespace std; inline int read() { char c=getchar();int num=0; for(;!isdigit(c);c=getchar()); for(;isdigit(c);c=getchar()) num=... 阅读全文
posted @ 2018-09-12 11:11 whymhe 阅读(208) 评论(0) 推荐(0) 编辑
摘要: //Pro: P2852 [USACO06DEC]牛奶模式Milk Patterns //后缀数组 //求出现次数>=k的最长可重叠字串的长度 //首先出现次数为k+1的串的长度肯定不大于出现次数为k的串 //所以我们就求出现次数为k次的串 //我们把这个串看成是原串的后缀的前缀 //那么这个串就是k个后缀的前缀 //而且这k个后缀的rnk是连续的 //又因为height[i]记录的是s... 阅读全文
posted @ 2018-09-12 11:10 whymhe 阅读(125) 评论(0) 推荐(0) 编辑
摘要: //Pro:P4051 [JSOI2007]字符加密 //我们将字符串复制一遍贴在后面 //然后对这个新字符串跑后缀数组 //令len=原字串的长度 //求出sa[]来后,对于那些sa[i]>len的串,不要他们 //要不然就存下sa[i]+len-1位置的字符 #include #include #include #include #include using namespace st... 阅读全文
posted @ 2018-09-12 11:09 whymhe 阅读(153) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int N=1e6+5; char s[N]; int n,m; int tax[N],tp[N],rnk[N],sa[N]; inline void Qsort() { for(int i=1;i=1;--i) sa[ta... 阅读全文
posted @ 2018-09-12 11:08 whymhe 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 题意翻译 给定一个字符串,求该字符串含有的本质不同的子串数量。 题目描述 Given a string, we need to find the total number of its distinct substrings. 输入输出格式 输入格式: T- number of test cases 阅读全文
posted @ 2018-09-12 11:07 whymhe 阅读(210) 评论(0) 推荐(0) 编辑
摘要: //Pro:P4688 [Ynoi2016]掉进兔子洞 //ans= r1-l1+1 + r2-l2+1 +r3-l3+1 - ∑min(cnt1[i],cnt2[i],cnt3[i])*3 //计算cnt可以用莫队 //如何计算cnt的min //用bitset (第一次用这玩意真神奇 //将原数组排个序 //将每个数离散化为它在有序数组中出现的第一个位置 //bitset里的每一位对应... 阅读全文
posted @ 2018-09-12 11:06 whymhe 阅读(235) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int N=3e3+5; int n; string str; int num; inline char check(string s,int len) { int cnt=0; for(int i=0;i>=1; s=ro... 阅读全文
posted @ 2018-09-12 11:04 whymhe 阅读(183) 评论(0) 推荐(0) 编辑
摘要: //Pro:NOIP 2011 P1313 计算系数 //可以用杨辉三角来推 //但是,在这儿给出一个比较麻烦的解法:) //锻炼数学技巧233 //sol: //由二项式定理推出系数,当然了暴力乘的话肯定会炸的,而且不能取模 //所以,把分子和分母上的数存下来,进行质因数分解约分 //质因数分解的话,先筛个素数 //然后再做除法 //然后让系数乘上x的系数a的n次方再乘上y的系数b... 阅读全文
posted @ 2018-09-12 11:03 whymhe 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; const int N=1e6+5; const int M=2e4; int n; char t[N],p[155][75]; int nxt[M][26]; int id[M],fail[M],last[M]; int now_node;... 阅读全文
posted @ 2018-09-12 11:02 whymhe 阅读(232) 评论(0) 推荐(0) 编辑
摘要: //Pro:NOIP2008 T2 P1149 火柴棒等式 #include #include #include #include #include using namespace std; const int N=50; const int stick[N]={6,2,5,5,4,5,6,3,7,6}; int n; int work(int x) { int res=0; ... 阅读全文
posted @ 2018-09-12 11:01 whymhe 阅读(197) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 24 下一页