| ||||||||||
| 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 | |||||||||
Wrong answer,请高手指点!//1006.cpp
#include <iostream.h>
#include <math.h>
#include <fstream.h>
void main(void){
int p,e,i,d,init;
// ifstream fin;
// fin.open("in.txt");
cin>>p>>e>>i>>d;
for(int x=1;p != -1 ;x++){
if(d >= i){
init = d-(d-i)%33;
}
else{
init = d+(i-d)%33;
}
if(init == d)
init += 33;
for(int n=init;n<=21252+d;n += 33){
if((n-p)%23 == 0){
if((n-e)%28 == 0){
cout<<"Case "<<x<<": the next triple peak occurs in "<<n-d<<" days."<<endl;
break;
}
}
if((n+33) > 21252+d){
cout<<"Case "<<x<<": the next triple peak occurs in "<<n-d<<" days."<<endl;
}
}
cin>>p>>e>>i>>d;
}
// fin.close();
return;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator