| ||||||||||
| 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 | |||||||||
求助:到底哪里错了..谢谢!/***********************************
acm1006:Biorhythms
by Chen Wei
2005.4
***********************************/
#include <iostream.h>
int main(){
int p,e,i,d,n = 0;
cin >>p >>e >> i >>d;
while(1){
n++;
if( (p == -1) && (e == -1) && (i == -1) && (d == -1) ) return 0;
if( (p == e) && (p == i) ){
d = p + 21252 - d; //23,28,33的最小公倍数
}
else {
while(1){
i += 33;
if( (i - e) % 28 == 0) break;
}
while(1){
i += 924;
if( (i - p) % 23 == 0){
if( i == d ) d += 21252;
else d = i - d;
break;
}
}
}
cout <<"Case " <<n <<": the next triple peak occurs in " <<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