HDU 1711Number Sequence(KMP算法详解)

转载请注明出处:http://blog.csdn.net/a1dark

分析:KMP模板题、KMP的关键是求出next的值、先预处理出next的值、然后一遍扫过、复杂度O(m+n)、

#include
#include
#define N 1000005
int s[N];
int p[N];
int next[N];
int m,n;
void getnext(){
    int j=0,k=-1;
    next[0]=-1;
    while(j


你可能感兴趣的:(ACM竞赛)