标签:
Description
Input
Output
Sample Input
0 0 0 0 0 0 0 100 5 20 34 325 4 5 6 7 283 102 23 320 203 301 203 40 -1 -1 -1 -1
Sample Output
Case 1: the next triple peak occurs in 21252 days. Case 2: the next triple peak occurs in 21152 days. Case 3: the next triple peak occurs in 19575 days. Case 4: the next triple peak occurs in 16994 days. Case 5: the next triple peak occurs in 8910 days. Case 6: the next triple peak occurs in 10789 days.
Hint
Translator
暴力随便做。。。对了 是从d+1天开始 wa两次。。。。
#include <stdio.h>
int main()
{
int p,e,q,d;
int t=0;
while(~scanf("%d %d %d %d",&p,&e,&q,&d))
{
if(p==-1&&e==-1&&q==-1&&d==-1)
break;
p=p%23;e=e%28;q=q%33;
for(int i=d+1;;i++)
{
if(i%23==p&&i%28==e&&i%33==q)
{
printf("Case %d: the next triple peak occurs in %d days.\n",++t,i-d);
break;
}
}
}
return 0;
} 标签:
原文地址:http://blog.csdn.net/su20145104009/article/details/51372235