随笔分类 - KMP
摘要:题目 KMP算法的熟练运用 由于KMP预处理是对模式串本身进行KMP 所以串尾、pre[size]部分完全一致,且pre[size]和pre[pre[size]]部分一致…… 所以就代表一个循环节 若(size-pre[size])刚好能被size整除,则为循环节 #include <cstdio>
阅读全文
摘要:题目 前后缀的重合,很有KMP的感觉 next(或者pre)的妙用 最后输出答案用了递归 #include <string> #include <iostream> #define MAXN 400005 using namespace std; string str; int pre[MAXN];
阅读全文
摘要:#include <cstdio> #include <algorithm> #include <string> #include <iostream> #define MAXN 1000006 std::string pat,txt; int pre[MAXN]; int main() { std
阅读全文

浙公网安备 33010602011771号