poj 2406 kmp
来源:互联网 发布:eclipse 运行java程序 编辑:程序博客网 时间:2024/06/18 11:05
#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn=1e6+9;int next[maxn];char a[maxn];int main(){ while(1) { memset(a,0,sizeof(a)); scanf("%s",a+1); if(a[1]=='.') break; next[1]=0; int n=strlen(&a[1]); for(int i=2;i<=n;i++) { int t=i-1; while(t&&a[i]!=a[next[t]+1]) t=next[t]; next[i]=next[t]+(a[i]==a[next[t]+1]); } int ans=n-next[n]; if(n%ans) printf("1\n"); else printf("%d\n",n/ans); } return 0;}
- poj 2406 KMP
- POJ 2406 KMP
- 【KMP】POJ 2406
- poj 2406 KMP应用
- POJ 2406 (KMP)
- POJ 2406 kmp
- poj 2406 KMP算法
- poj 2406 kmp
- poj 2406(kmp)
- POJ 2406 KMP
- POJ 2406 依然 KMP
- poj 2406 KMP
- POJ-2406(KMP)
- POJ 2406 KMP
- POJ 2406 (KMP)
- POJ 2406 KMP
- 字符串 KMP POJ 2406
- POJ 2406(kmp)
- windows命令行设置网卡ip地址
- HDU3466:Proud Merchants(01背包)
- USB 供电问题
- NYOJ571 整数划分(三)
- Chrome 网络调试小技巧,保存重定向的日志开关
- poj 2406 kmp
- linux中寻找文件目录
- 记录一次iis发布的经历<compilation debug="true" targetFramework="4.0">报错,默认画面不起作用
- 日记,有关方法和实践的一些讨论
- IPV4的V6表示法
- 用邮件群发做网站推广的技巧和注意事项
- poj 2752 Seek the Name, Seek the Fame
- JavaScript中confirm,alert,prompt的用法及返回值
- windows update 当前无法检查更新,因为未运行服务 真正有效的解决办法之一 y460