| ||||||||||
| 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 | |||||||||
where is my mistake?#include <iostream>
using namespace std;
const int ptime=23,etime=28,itime=33;
int p,e,i,d;
int result,k,num=0;
int main(){
cin>>p>>e>>i>>d;
while(p!=-1&&e!=-1&&i!=-1&&d!=-1){
++num;
for(int ii=1;ii<=etime*itime;++ii){
result=(p+ptime*ii-e)%etime;
if(result==0){
result=(p+ptime*ii-i)%itime;
if(result==0){
k=ii;
goto lable;
}
}
}
lable: ;
result=p+ptime*k;
if(result-d>21252)
result-=21252;
result-=d;
cout<<"Case "<<num<<": the next triple peak occurs in "<<result<<" days."<<endl;
cin>>p>>e>>i>>d;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator