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 |
大虾看看哪错了!!!#include<iostream> using namespace std; int main() { int p,q,r,i=0,j,a,b,c,d,S; while(cin>>p>>q>>r>>d) { if(p==-1&&q==-1&&r==-1&&d==-1) break; i++; if(p>=23) p=p%23; if(q>=28) q=q%28; if(r>=33) r=r%33; for(j=0;j<=644;j++) { S=j*33+r; if((S-p)%23==0&&(S-q)%28==0&&S>d) break; } cout<<"Case "<<i<<": the next triple peak occurs in " <<S-d<<" 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