poj3461 Oulipo (KMP模板题~) 前面哪些也是模板题 O.O
来源:互联网 发布:魔域帐号交易淘宝 编辑:程序博客网 时间:2024/06/05 13:25
# include <stdio.h># include <algorithm># include <string.h>using namespace std;char a1[1000010],a2[1000010];int next[1000010];int len1,len2,cot;void Getnext(){ int i=0,j=-1; next[0]=-1; while(i<=len1) { if(j==-1||a1[i]==a1[j]) i++,j++,next[i]=j; else j=next[j]; }}void KMP(){ int i,j; j=0; for(i=0; i<len2;) { if(a2[i]==a1[j]||j==-1) { i++; j++; if(j==len1) { // i-=len1-1; //j=0; j=next[j];//这步运用next~~~~ cot++; } } else j=next[j]; }}int main(){ int t; scanf("%d",&t); while(t--) { scanf("%s",a1); scanf("%s",a2); len1=strlen(a1); len2=strlen(a2); Getnext(); cot=0; KMP(); printf("%d\n",cot); } return 0;}
1 0
- poj3461 Oulipo (KMP模板题~) 前面哪些也是模板题 O.O
- POJ3461 Oulipo KMP模板
- poj3461 kmp 模板题
- poj3461 KMP模板题
- poj3461 kmp模板题
- POJ3461(KMP模板题)
- POJ3461(KMP模板题)
- POJ Oulipo(KMP模板题)
- KMP模板题 poj 3461 Oulipo
- poj 3461 Oulipo(kmp 模板题)
- 【哈希&KMP模板题】-POJ-3461-Oulipo
- poj 3461 Oulipo(KMP模板题)
- POJ 3461 Oulipo (KMP模板题)
- POJ - 3461 Oulipo(KMP模板题)
- poj 3461 Oulipo (KMP 模板题)
- hdu 1686 Oulipo -- (KMP模板题)
- POJ 3461 Oulipo [KMP模板题]
- POJ 3461 Oulipo KMP模板题
- 在Win8系统中修改hosts文件无法保存的解决方法
- IArea
- android开发之setFocusable()和 setFocusableInTouchMode()方法的区别
- 13.JavaWeb基础 监听器
- Interleaving String
- poj3461 Oulipo (KMP模板题~) 前面哪些也是模板题 O.O
- Laplace算子
- java 并发 (1):原子计数器
- 10道经典java编程笔试题
- 动态索引结构和索引更新机制
- 排序之冒泡排序--参考MoreWindows
- linux命令行学习-dig(DNS查询器)
- Qt- 绘制实时曲线
- 安装libvirt install libvirt