poj2752 Seek the Name, Seek the Fame (串)
来源:互联网 发布:网络主题团日活动 编辑:程序博客网 时间:2024/05/16 14:10
题目链接:http://poj.org/problem?id=2752
//pku2752//题目意思://给一个串,找出所有前缀也是后缀的情况#include<iostream>#include<cstring>using namespace std;char str[400002];int next[400002];int result[400002];int len;void index()//用KMP算出next[1~len]{int i=0,j=-1;next[0]=-1;while(i<len){if(j==-1||str[i]==str[j])//匹配{++i;++j;next[i]=j;}else j=next[j];//j往回走}}int main(){while(gets(str)){len=strlen(str);int i=0,j=len;index();while(j!=0){result[i++]=j;//从大到小记录可行情况j=next[j];//j往回走}int k;for(k=i-1;k>=0;k--){cout<<result[k];if(k>0)cout<<" ";}cout<<endl;}return 0;}
- POJ2752 Seek the Name, Seek the Fame
- POJ2752:Seek the Name, Seek the Fame
- poj2752 Seek the Name, Seek the Fame
- POJ2752 Seek the Name, Seek the Fame
- poj2752 seek the name seek the fame
- poj2752 Seek the Name, Seek the Fame
- POJ2752 Seek the Name, Seek the Fame
- poj2752-Seek the Name, Seek the Fame
- poj2752 Seek the Name,Seek the Fame
- POJ2752 Seek the Name, Seek the Fame
- poj2752 seek the name,seek the fame
- POJ2752 Seek the Name, Seek the Fame
- POJ2752 Seek the Name, Seek the Fame
- poj2752 Seek the Name, Seek the Fame
- POJ2752-Seek the Name, Seek the Fame
- [POJ2752] Seek the Name,Seek the Fame
- POJ2752 Seek the Name, Seek the Fame
- 【POJ2752】seek the name,seek the fame
- hdu 1015
- ICPC_shanghai_2000_舞蹈家 (DP)
- hdu 1754 I Hate It (线段树)
- iOS的基本设计模式
- JSF 2.0简介:Ajax对页面的增加与删除操作例子
- poj2752 Seek the Name, Seek the Fame (串)
- patchGuard v2
- Stanford 算法入门 week 6 Bloom Filter, Hash Function, Search Tree
- hdu1233 还是畅通工程 ( 最小生成树)
- svn版本控制系统在CentOS上的部署
- hdu1874 畅通工程续 (最短路)
- 网络整合营销之策略
- hdu1596 最短路
- ACM中使用JAVA