摘要:
/*求形成循环节需要增加颜色珠子。*/#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>#include<algorithm>#include<vector>using namespace std;int lena,lenb,Max;int nt[100005];void getnt(string b){ int j=0,k=-1; nt[0]=-1; while(j<lenb) { if(k 阅读全文
摘要:
/*求循环节和循环周期已经保证一定是循环字符串*/#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>#include<algorithm>#include<vector>using namespace std;#define M 1000005int lena,lenb,Max;int nt[M];char b[M];void getnt(char *b){ int j=0,k=-1; nt[0]= 阅读全文
摘要:
/*题意:求循环节最长长度nt[]数组的分布:abcd -1 0 0 0 0 aaaa-1 0 1 2 3abab-1 0 0 1 2注意-1后再也没有出现过-1啦*/#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>#include<algorithm>#include<vector>using namespace std;#define M 1000005int lena,lenb,Max;in 阅读全文
摘要:
/*题意:求公共前缀和后缀相同的部分是什么Input:ababcababababcababaaaaaOutput:2 4 9 181 2 3 4 5*/#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>#include<algorithm>#include<vector>using namespace std;#define M 400005int lena,lenb,Max;int nt[M];c 阅读全文