KMP
李嘉图.M.董
这个作者很懒,什么都没留下…
展开
-
kmp 字串
https://ac.nowcoder.com/acm/problem/13253 思路 因为我们只要保证所给t是s的字串,即kmp模板; 我们的重点是求s,t中最大的进制,最有可能使得t是s的字串,所以s要抓缓存最大的进制。 #include <stdio.h> #include <algorithm> #include <iostream> #include...原创 2019-11-03 20:49:00 · 121 阅读 · 0 评论 -
KMP扩展
参考https://www.luogu.org/problemnew/solution/P5410 题目描述 有两个字符串aa,bb,要求输出bb与aa的每一个后缀的最长公共前缀 输入格式 两行,分别为两个字符串aa,bb 输出格式 共两行 第一行有lenb个数,为b的next数组(特别地,next 0为lenb) 第二行有lena个数,即答案 输入输出样例 输入 aaaabaa aaaaa 输...原创 2019-08-03 22:21:19 · 69 阅读 · 0 评论 -
KMP 3种板子
#include <stdio.h> #include <string.h> #define maxn 1000010 char a[maxn],b[maxn],next[maxn]; void get_next() { int k=-1; int j=0; next[0]=-1; int b_len=strlen(b); while...原创 2019-08-03 22:23:55 · 211 阅读 · 0 评论