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 |
居然还有小于等于零的状况,WTF,今天状态不好……WA好几次#include<iostream> using namespace std; int main() { int p,e,i,d,t,x,find,ans,count=0; while(1) { cin>>p>>e>>i>>d; if(p==-1) break; count++; find=0; for (x=1;!find;x++) if ((p+23*x-e)%28==0&&(p+23*x-i)%33==0) {find=1;ans=p+23*x-d;break;} if (ans>21252) ans%=21252; while(ans<=0) ans+=21252; cout<<"Case "<<count<<": the next triple peak occurs in "<<ans<<" days."<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator