poj(2752)
来源:互联网 发布:身份证拍照软件 编辑:程序博客网 时间:2024/05/22 13:59
题目:http://poj.org/problem?id=2752
#include <stdio.h>#include<string.h>#include<algorithm>#define MAX 400005using namespace std;int next[MAX];char a[MAX];int lena;int aa[MAX];void getnext(char *p){ int i = 0, j = -1; next[0]= -1; while(i != lena){ if(j ==-1 || p[i] == p[j]) next[++i] = ++j; else j =next[j]; }}int main(){ while(gets(a)){ lena =strlen(a); memset(next,0,sizeof(next)); getnext(a); int tt =lena; intj=0; for(;next[tt] != -1;tt = next[tt]) aa[j++] =tt; for(inti = j-1;i>=0;i--) printf("%d ",aa[i]); printf("\n"); } return 0;}
0 0
- POJ 2752
- poj 2752
- poj 2752
- POJ 2752
- poj 2752
- POJ 2752
- poj(2752)
- POJ 2752
- poj 2752
- POJ 2752
- poj 2752
- POJ-2752
- POJ 2752
- POJ-2752
- poj 2752
- Poj 2752
- poj 2752
- POJ 2752
- oracle恢复10分钟之前的数据
- poj(1088)
- poj3461
- usaco traini 5.2.2 Electric Fences 题解
- hdu 3746
- poj(2752)
- poj2406
- ADF自定义控件例子
- hoj (2275)树状数组
- hdu(4325)
- mt6577驱动开发 笔记版 转载请注明出处---crosskernel@gmail.com
- IMP-00013: 只有 DBA 才能导入由其他 DBA 导出的文件
- hdu(4310)
- hdu 4296 Building