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,e,i,d,pe,temp,res; int cnt = 1; while(1){ cin>>p>>e>>i>>d; if(p==-1&&e==-1&&i==-1&&d==-1){ return 0; } p=p%23; e=e%28; i=i%33; temp=1; while(1){ while((e-p+temp*5)%23!=0) temp++; pe = e+28*temp; if((pe-i)%33!=0){ temp++; continue; } else break; } pe-d>0? res=pe-d:res=pe-d+21252; cout<<"Case "<<cnt<<": the next triple peak occurs in "<<res<<" days."<<endl; cnt++; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator