hdu 4763
来源:互联网 发布:记账软件电脑版 编辑:程序博客网 时间:2024/05/17 23:09
点击打开链接//kmp#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn=1e6+5;char T[maxn];int n,m;void Getnext(int next[]){ m=strlen(T); int i=0,j=next[0]=-1; while(i<m) { if(j==-1||T[i]==T[j]) { i++; j++; next[i]=j; } else j=next[j]; }}int main(){ while(scanf("%d",&n)==1) { for(int i=0;i<n;i++) { scanf("%s",T); int next[maxn]; Getnext(next); int k=m; int ans=0; while(k>0) { if(k*2<=m) ans=max(ans,k); k=next[k]; } printf("%d\n",ans); } } return 0;}
阅读全文
0 0
- hdu 4763
- hdu 4763
- HDU 4763 Theme Section
- HDU 4763 拓展KMP
- HDU 4763 KMP算法...
- hdu 4763 Theme Section
- HDU 4763 EXKMP
- hdu 4763 Theme Section
- HDU-4763 Theme Section
- HDU 4763 Theme Section
- HDU 4763 (KMP)
- Hdu-4763 Theme Section
- hdu 4763 Theme Section
- hdu 4763 Theme Section
- HDU 4763 KMP/EXKMP
- HDU 4763Theme Section
- hdu 4763 Theme Section
- hdu 4763 Theme Section
- 3D绘图
- 文章标题
- 刻板表征与潜抑置换
- 将tensorflow训练好的模型移植到android
- const与#define
- hdu 4763
- 排序:简单排序-堆
- 100-300间能被3整除得数的和
- java权限管理与用户角色权限设计
- break 和continue 区别以及用法。
- UIButton按钮自适应排布,自动换行
- zookeeper的分布式搭建步骤
- 学习笔记:Java 分类枚举和策略枚举(枚举的嵌套)
- delphi 开发二维码。