题目:http://poj.org/problem?id=1006
水题。枚举。
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
using namespace std;
int a[1000003];
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
int p,e,i,d;
int cas = 0;
while(scanf(" %d %d %d %d",&p,&e,&i,&d)!=EOF)
{
cas++;
if (p==-1)
{
break;
}
int temp = d;
d++;
while((d-p)%23!=0)
{
d++;
}
while((d-e)%28!=0 || (d-i)%33!=0)
{
d+=23;
}
printf("Case %d: the next triple peak occurs in %d days.\n",cas,d-temp);
}
return 0;
}