POJ 2572 Seek the Name, Seek the Fame
来源:互联网 发布:网络大神级作家排行榜 编辑:程序博客网 时间:2024/04/30 11:59
简单的KMP,不解释
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int next[400005];int num[400005];int main(){ int i,j,len; char str[400005]; while(scanf("%s",str)!=EOF) { len=strlen(str); memset(next,0,sizeof(next)); j=0; for(i=1;i<len;i++) { while(j>0&&str[i]!=str[j]) j=next[j-1]; if(str[i]==str[j]) j++; next[i]=j; } j=len; int k=0; while(j>0) { j=next[j-1]; if(j!=0) num[k++]=j; } for(i=k-1;i>=0;i--) printf("%d ",num[i]); printf("%d\n",len); } return 0;}
0 0
- poj seek the name,seek the fame
- poj---Seek the Name, Seek the Fame
- Seek the Name, Seek the Fame POJ
- Seek the Name, Seek the Fame POJ
- POJ 2572 Seek the Name, Seek the Fame
- 【POJ 2572】Seek the Name, Seek the Fame
- POJ-2752 Seek the Name, Seek the Fame
- poj 2752 Seek the Name, Seek the Fame
- poj 2752 Seek the Name, Seek the Fame(KMP)
- POJ 2752--Seek the Name, Seek the Fame (next)
- POJ:2752Seek the Name, Seek the Fame
- POJ 2752 - Seek the Name, Seek the Fame
- poj 2752 Seek the Name, Seek the Fame
- poj 2752 Seek the Name, Seek the Fame
- POJ-2752-Seek the Name, Seek the Fame
- POJ 2752 Seek the Name, Seek the Fame
- poj 2752 Seek the Name, Seek the Fame
- poj 2752 Seek the Name, Seek the Fame
- [hdu-2046] 骨牌铺方格
- 再读《Short Brain 》
- 最受欢迎的ASP.NET的CMS下载
- 用户界面——屏幕和键盘
- cocos2dx返回Android游戏黑屏解决办法
- POJ 2572 Seek the Name, Seek the Fame
- Ubuntu系统下安装Skype 4.2版本(支持微软账户)
- 判断单链表是否存在环及求环入口点
- Hadoop Eclipse Server IPC version 5 cannot communicate with client version 3
- png在线压缩
- python之matplotlib学习
- 修改屏幕密度
- 手把手教你如何加入到GitHub的开源世界!
- C#-树视图TreeView---ShinePans