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 IC0500510025 at 2005-12-17 19:25:03 on Problem 1012
我运行的挺快的:
#include <stdio.h>
void main()
{	int k,m,n,i,judge=1,r;
	for(;;)
	{	scanf("%d",&k);
		if(k==0) return;
		m=1;;
		for(;;)
		{	m++;judge=1;r=0;n=2*k
			for(i=0;i<k;i++)
			{	r=(n+m-r)%n;
				if(r>0&&r<=k) {judge=0;break;}
				else { r=(n-r)%n;n--;}
			}
			if(judge) {printf("%d\n",m);break;}
			//printf(" m=%d\n",m);
		}
	}
}

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