POJ---3461-Oulipo(KMP)
来源:互联网 发布:单片机控制12v继电器 编辑:程序博客网 时间:2024/06/06 02:12
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#define SIZE 1000000using namespace std;int next[SIZE+2];char str[SIZE+1];char poi[10001];int lena ,lenb;void get_next(){ int i=0,j=-1; next[0]=-1; while(i<lenb) { if(j==-1||str[i]==str[j]) next[++i]=++j; else j=next[j]; }}int main(){ int n; cin>>n; while(n--) { scanf("%s%s",poi,str); lena=strlen(poi); lenb=strlen(str); get_next(); int i=0,j=0,sum=0; while(i<lenb) { if(j==-1||str[i]==poi[j]) { ++i; ++j; } else j=next[j]; if(j==lena) { ++sum; j=next[j]; } } cout<<sum<<endl; } return 0;}
0 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)
- 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
- Oulipo - POJ 3461 KMP
- Android中 在开启的多个Activity中关闭特定的Activity的方法
- 框架学习方法
- 用Dotfuscator对dll混淆
- 四会代办医院诊断证明
- Contaning Block
- POJ---3461-Oulipo(KMP)
- Android 屏幕适配方案
- 陆丰代办医院诊断证明
- 杂谈:每一代人的工作心态
- column mode in VIM
- Ubtun的内存CPU上传下载速率读取-qt
- 使用Gradle发布SNAPSHOT版本到JCenter(oss.jfrog.org)
- Apache2.2+Tomcat7.0集群 完美攻略
- 学习Keystone之(1): Multi Domain 支持下的ID Mapping