poj 2752
来源:互联网 发布:侧田 情歌 知乎 编辑:程序博客网 时间:2024/06/08 08:08
#include<stdio.h>#include<string.h>char s[400005];int next[400005],sta[400005],all;void get_next(){ int len=strlen(s+1),i=1,j; next[1]=j=0; while(i<=len) { if(j==0||s[i]==s[j]) next[++i]=++j; else j=next[j]; }}void solve(){ int len=strlen(s+1),i; all=0,sta[all++]=len; for(i=len;i>1;) { if(next[i+1]>1) sta[all++]=next[i+1]-1; i=next[i+1]-1; }}void print(){ int i; for(i=all-1;i>0;i--) printf("%d ",sta[i]); printf("%d\n",sta[i]);}int main(){ while(scanf("%s",&s[1])>0) { get_next(); solve(); print(); } 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
- Androidstudio运行出现Unsupported method: AndroidProject.getPluginGeneration() while running project
- 矩阵快速幂——HDU 2604
- 微软商业智能和分析平台高歌猛进,一骑绝尘,成为当之无愧BI分析平台的领导者
- SharePoint 2016 文档库的新功能简介
- 获取公众号的所有文章
- poj 2752
- 无卡支付时代 银行信用卡联手京东金融欲打翻身仗
- 尚硅谷java学习笔记——12.java常用类
- JQuery学习笔记
- hdu 2087
- Android 仿映客直播间给主播发送礼物(实现连击效果)
- topk问题java实现
- Java 按单词倒序输出字符串
- 问题:java.sql.SQLException: Column count doesn't match value count at row 1