Posted on 2010-08-17 14:10
Brian 阅读(149)
评论(0) 编辑 收藏 引用 所属分类:
POJ
典型的
阅读理解题 , 读懂意思基本上思路就出来了,恰巧又是一道中文题,这里用枚举,其他不解释。
#include <stdio.h>
int main()


{
int i,a,b,c,d,days=0;
while(1)

{
days++;
scanf("%d%d%d%d",&a,&b,&c,&d);
if (a+b+c+d == -4) break;
for (i=d+1; ; i++) // pay attention: from d+1

{
if ((i-a)%23==0)
if ((i-b)%28==0)
if ((i-c)%33==0)

{
printf("Case %d: the next triple peak occurs in %ld days.\n",days,i-d);
break;
}
}
}
return 0;
}