Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么超时!!

Posted by cjx_epop at 2007-05-23 09:41:57
源代码:
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator