| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
why my codes show time limited excuted?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator