poj 3461 Oulipo(KMP,喜闻乐见纯模板)
来源:互联网 发布:淘宝客服招聘在家 编辑:程序博客网 时间:2024/06/06 03:07
纯模板。
#include<stdio.h>#include<string.h>#define N 1000005#define M 10005char s1[M],s2[N];int ln1,ln2;int next[N];void setNext(char *s){int i,j;j=-1;i=0;next[i]=j;while(i<ln1){if(j==-1||s[i]==s[j]){i++;j++;next[i]=j;}elsej=next[j];}return ;}int main(){int T;scanf("%d",&T);getchar();while(T--){gets(s1);gets(s2);int i,j;i=j=0;ln1=strlen(s1);ln2=strlen(s2);setNext(s1);int cnt=0;while(j<ln2){if(i==-1||s1[i]==s2[j]){i++;j++;if(i==ln1){cnt++;i=next[i];}}elsei=next[i];}printf("%d\n",cnt);}return 0;}
- poj 3461 Oulipo(KMP,喜闻乐见纯模板)
- poj 3461 Oulipo(kmp 模板题)
- POJ 3461 Oulipo(KMP模板)
- POJ 3461 Oulipo (kmp模板)
- poj 3461 Oulipo(KMP模板题)
- POJ - 3461 Oulipo(KMP模板题)
- POJ 3461 Oulipo(KMP模板)
- POJ 3461 Oulipo(KMP模板题)
- POJ:3461-Oulipo(KMP模板题)
- POJ 3461 Oulipo(KMP模板)
- KMP模板题 poj 3461 Oulipo
- 【哈希&KMP模板题】-POJ-3461-Oulipo
- POJ 3461 Oulipo (KMP模板题)
- poj 3461 Oulipo (KMP 模板题)
- POJ 3461 Oulipo [KMP模板题]
- POJ 3461 Oulipo KMP模板题
- POJ 3461 - Oulipo(KMP)
- POJ-3461 Oulipo(KMP)
- 0731leetcode刷题总结
- oracle数据库升级记(记一次10.2.0.3版本升级到11.2.0.1版本的过程)
- Delegate,Action,Func的应用
- Eclipse中使用ANT
- LabVIEW动态数据交换DDE
- poj 3461 Oulipo(KMP,喜闻乐见纯模板)
- Java中static、this、super、final用法
- ETL 简介
- Android应用开发中对Bitmap的内存优化
- HDU 4630、BOJ 某题
- android中如何显示图片的一部分
- RUBY的CGI使用方法
- LabVIEW调用DDL中函数
- yield() sleep() wait() 区别