poj2752 Seek the Name, Seek the Fame
来源:互联网 发布:单词朗读软件 知乎 编辑:程序博客网 时间:2024/06/05 11:01
KMP前缀数组的理解与应用(一)
poj2752,
#include<stdlib.h>#include<stdio.h>#include<string.h>#define N 400100char s[N];int a[N],next[N];void Creat_next(){ int len=strlen(s); int j=0; for(int i=1;i<len;i++) { while(j>0&&s[i]!=s[j]) j=next[j-1]; if(s[i]==s[j]) j++; next[i]=j; }}int main(){ while(~scanf("%s",s)) { Creat_next(); int k=0; int i=strlen(s)-1; while(next[i]>0) { a[k]=next[i]; k++; i=next[i-1]; } for(i=k-1;i>=0;i--) printf("%d ",a[i]); printf("%d\n",strlen(s)); } return 0;}
0 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
- 一些学习笔记,仅作本人记录之用
- 题目:输入两个链表,找出它们的第一个公共结点
- NOIP2016 暑期培训 D4
- 百分比布局中的与GridView
- java虚拟机原理浅析
- poj2752 Seek the Name, Seek the Fame
- hdu 5538 House Building(长春现场赛)
- 51nod:1049 最大子段和
- C/C++零碎集——第二集
- 148.View the Exhibit. Which statements are true regarding the USERS tablespace? (Choose all that app
- Vim编辑器精通
- 刚体变量
- Centos6.5安装Maven
- linux 关闭popen 打开的命令