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

why my codes show time limited excuted?

Posted by qimi at 2009-03-06 20:22:47 on Problem 1012
#include<iostream>
using namespace std;
int main(){
	int m,n,i,j,k,x;
	cin>>k;
	while(k>0&&k<14){
		for(m=2;;m++){
			n=2*k;j=1;
			for(i=1;i<=k;i++){
				x=(m+j-1)%n;
				if(x<=k&&x>0) break;
				n--;
				if(x==0)j=1;
				else j=x;
			}
			if(i==k+1) {cout<<m<<endl;break;}
		}
		cin>>k;
	}
	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