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

Re:各位高手帮忙看看啊。不胜感谢....怎么总说超时了啊??

Posted by highspeed at 2009-12-09 16:32:19 on Problem 1012
In Reply To:各位高手帮忙看看啊。不胜感谢....怎么总说超时了啊?? Posted by:qichao at 2009-07-20 21:08:11
> #include<stdio.h>
> 
> int main()
> {
> 	int i,j,t,a[14],k;
> 	unsigned long int n;
> 	scanf("%d",&k);	
> 	while(k!=0)
> 	{
> 		for(n=k;1;n++)
> 		{
> 			for(i=0;i<2*k;i++)
> 				a[i]=i+1;
> 			for(i=2*k,t=0;i>k;i--)
> 			{
> 				t=(t+n-1)%i;
> 				if(a[t]<=k)
> 					break;
> 				for(j=t;j<i-1;j++)
> 					a[j]=a[j+1];
> 			}
> 			if(i<=k)
> 			{
> 				printf("%d\n",n);
> 				break;
> 			}
> 		}
> 		scanf("%d",&k);
> 	}
> }

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