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:the Chinese remainder theoremIn Reply To:请问大家怎样才能不超时?痛苦死了 Posted by:yeti at 2005-03-12 03:00:45 > #include<iostream.h> > #include<math.h> > void main() > { > > int p,e,i,d,t=0,u=0; > while(1){ > u++; > cin>>p>>e>>i>>d; > if(p==-1 && e==-1 && i==-1 && d==-1) break; > for(t=d+1;;t++){ > if((t-p)%23==0 && (t-e)%28==0 && (t-i)%33==0){ > cout<<"Case "<<u > <<": the next triple peak occurs in " > <<t-d<<" days."<<endl; > break; > } > } > > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator