| ||||||||||
| 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 | |||||||||
为什么超时!!源代码:
#include"stdio.h"
#include"string.h"
#define MAXLEN 1000000
char a[MAXLEN];
int c[MAXLEN]={0};
int main()
{
int len,i,j,z,mix,h=0;
scanf("%s",a);
while(a[0]!='.')
{
len=strlen(a);
if((len+1)%2==0)
c[h++]=1;
else
{
for(i=1;i<=len/2;i++)
{
for(j=0;j<len-i-1;j++)
{
if(a[j]!=a[j+i])
break;
}
if(j==len-i-1 || (j+1)*2==len)
{
mix=i;
break;
}
}
if(i>len/2 || (len+1)%2==0)
c[h++]=1;
else
c[h++]=len/mix;
}
scanf("%s",a);
}
for(z=0;z<h;z++)
{
printf("%d\n",c[z]);
}
return 0;
}
搞不明白,为什么。。。。。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator