两种方法 首先是纯KMP #include<stdio.h> #include<string.h> #include<iostream> using namespace std; char str1[200010],str2[100010]; int next[100010]; int get() { next[0]=-1; int j=0; int k=-1; int len=strlen(str2); while(j<len-1) { if(k==-1…
Theme Section Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 574 Accepted Submission(s): 308 Problem Description It's time for music! A lot of popular musicians are invited to join us in th…
http://acm.hdu.edu.cn/showproblem.php?pid=4847 Wow! Such Doge! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4847 Description Chen, Adrian (November 7, 2013). “Doge Is An Ac- tually Good Inter…
亲和串 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10862 Accepted Submission(s): 4940 Problem Description 人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长…
循环移位的套路操作就是一份折开变两份 /*H E A D*/ void match(){ int n=strlen(T+1); int m=strlen(P+1); int j=0; rep(i,1,n){ if(flag)break; while(j>0&&(j==m||T[i]!=P[j+1])) j=nxt[j]; if(T[i]==P[j+1]) j++; f[i]=j; if(f[i]==m){ flag=1; break; } } } int main(){ while(…