| ||||||||||
| 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 | |||||||||
Re:sdfdfgIn Reply To:Re:sdfdfg Posted by:90401304 at 2005-01-03 17:39:02 > #include <stdio.h>
> #include <iostream.h>
> void main(){
> long int m;
> int k,i,cur,per;
> cin>>k;
> while(k!=0){
> if(k==1)cout<<"2"<<endl;
> for(m=7632;;m++){
> if(m%(2*k)==0)cur=2*k;
> else cur=m%(2*k);
> if(m%(2*k)<=k)continue;
> for(i=2,per=2*k-1;i<=k;i++){
> if(cur==(per+1)){
> cur=m%per;
> if(cur==0)cur=per;
> if(cur<=k)break;
> per--;
> }
> else{
> cur=(m+cur-per-1)%per;
> if(cur==0) cur=per;
> if(cur<=k)break;
> per--;
> }
> }
> if(per==k){
> cout<<m<<endl;
> break;}
> }
> cin>>k;
> }
> }
>
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator