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 TN at 2005-11-08 17:12:24 on Problem 1012
In Reply To:那位高手帮帮我,给我一个好的更改建议 Posted by:hongqin at 2005-11-08 17:11:35
> #include"stdio.h"
> void main()
> {
> 	int a[30],k[200];
> 	int i=0,j=0,m,t,s=0;
> 	do
> 	{
> 		scanf("%d",&k[i]);
> 	}while(k[i++]);
> 	do
> 	{
> 		for(j=0;j<30;j++)
> 			a[j]=0;
> 	for(m=k[s]+1;;m++)
> 	{
> 		for(i=0,t=0,j=1;i<k[s];j++,t++)
> 		{
> 			if(t==2*k[s])
> 				t=0;
> 			if(a[t]==m)
> 			{
> 				j--;
> 				continue;
> 			}
> 			 if(j==m)
> 			{
> 				if(t+1>k[s])
> 				{
> 					i++;
> 					a[t]=m;
> 					j=0;
> 				}
> 				else
> 					break;
> 			}
> 		}
> 		if(i==k[s])
> 		{
> 			printf("%d\n",m);
> 			break;
> 		}
> 	}
> 	}while(k[++s]);
> }	

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