摘要:
给一个字符串S,求出所有前缀,使得这个前缀也正好是S的后缀。升序输出所有情况前缀的长度。KMP中的next[i]的意义就是:前面长度为i的子串的前缀和后缀的最大匹配长度。明白了next[i],那么这道题就很容易做了#include #include #include #include using namespace std;const int maxn=400005;char str[maxn];int next[maxn];int n;int ans[maxn];void getnext(char *str,int len){ next[0]=-1; int i=0,j=-1; ... 阅读全文
posted @ 2014-02-12 14:48
辰曦~文若
阅读(226)
评论(0)
推荐(0)

浙公网安备 33010602011771号