| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
真要命,居然OLE#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char input[400003];
int M[400003];
int res[400003];
int size;
int resize;
int main(){
size = 0; char c;
while(scanf("%c", &c) && ((c<='z' && c>='a')||(c=='\n'))){
if(c!='\n'){input[size++]=c;continue;}
int k=0, resize = 0;
for(int i=1; i<size; i++){
while(k>0 && input[k]!=input[i]) k=M[k];
if(input[k]==input[i]) k++;
M[i] = k;
}
k = M[size-1]; res[resize++] = size;
while(k>0) {res[resize++] = k; k=M[k-1];}
printf("%d", res[resize-1]);
for(int i=resize-2; i>=0; i--) printf(" %d", res[i]);
printf("\n");
size = 0;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator