Search found 2 matches

by yxszxwzh
Sun Oct 05, 2014 3:32 pm
Forum: Volume 4 (400-499)
Topic: 455 - Periodic Strings
Replies: 73
Views: 29228

Re: 455 - Periodic Strings,WA

Post in existing thread. Use search by problem number 455.
Two consecutive output are separated by a blank line.
Always print newline after last line and separate outputs by blank line. Change printing to
printf("%d\n",p);

if (n) puts("");

Don't forget to remove your code after getting ...
by yxszxwzh
Sun Oct 05, 2014 4:38 am
Forum: Volume 4 (400-499)
Topic: 455 - Periodic Strings
Replies: 73
Views: 29228

455 - Periodic Strings,WA

#include <cstdio>
#include<cstring>
#define MAXN 200
int main(){
char s[80+10];
int ok,p,n,len;
scanf("%d",&n);
while(n--){
scanf("%s",s);
len=strlen(s);
for(p=1;p<len;p++){
ok=1;
for(int i=p;i<len;i++){
if(s[i%p]!=s[i]) {ok=0;}
}
if(ok&&!(len%p))break;
}
if(n==0)printf("%d",p);
else ...

Go to advanced search