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 |
为什么tle#include<iostream> #include<cstring> using namespace std; char s[1000000]; int main() { while(scanf("%s",s)) { int len=strlen(s); if(s[0]=='.') break; int i,j; for(i=1;;i++) { bool can=1; for(j=0;j<i;j++) { int k; for(k=j;;k=k+i) { if(k+i>=len) { break; } if(s[k]!=s[k+i]) { can=0;//i不能用,break break; } } if(can==0)//i不能用,找i+1 break; } if(can==1)//i可以用输出len/i break; } printf("%d\n",len/i); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator