/*
Memory 87K Time 0MS
*/
#include <stdio.h>
int main()
{
int p, e, i, d;
int t;
int c = 0;
int peakOfCycle;
while (1)
{
scanf_s("%d %d %d %d", &p, &e, &i, &d);
if (p == -1)
break;
t = 0;
p %= 23; e %= 28; i %= 33;
while (1)
{
peakOfCycle = p + t++ * 23;
if (peakOfCycle <= d) continue;
if ((peakOfCycle - e) % 28 == 0 && (peakOfCycle - i) % 33 == 0)
{
printf_s("Case %d: the next triple peak occurs in %d days.\n", ++c, peakOfCycle - d);
break;
}
}
}
return 0;
}
北大ACM(1006Biorhythms)代码
猜你喜欢
转载自blog.csdn.net/David_TD/article/details/83655665
今日推荐
周排行