#include<iostream>
using namespace std;
int main()
{
int p,e,i,d,num = 1;
cin>>p>>e>>i>>d;
while((p!=-1) || (e!=-1) || (i!=-1) || (d!=-1)){
while((p!=e) || (p!=i)){
if(p<e){
if(p<i){
p+=23;
}else i+=33;
}
else{
if(e<i) e+=28;
else i+=33;
}
}
int days = (21252+p-d)%21252;
if(days == 0) days = 21252;
cout<<"Case " << num <<": the next triple peak occurs in " << days << " days."<<endl;
num++;
cin>>p>>e>>i>>d;
}
return 0;
}
POJ1006
最新推荐文章于 2018-04-18 00:08:20 发布