| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么总是WA啊????/* 1006 Biorhythms */
#include <stdio.h>
void main()
{
int p, e, i, d;
int sum1, sum2;
int n;
int cycle;
scanf("%d%d%d%d", &p, &e, &i, &d);
n = 0;
while ( !(p == -1 || e == -1 || i == -1 || d == -1) )
{
n++;
sum1 = p - e;
while (sum1 <= 0) sum1 += 23;
while ((sum1 % 28) != 0)
sum1 += 23;
sum1 += e;
sum2 = sum1 - i;
while ((sum2 % 33) != 0)
sum2 += 644;
sum2 += i;
cycle = sum2 - d;
cycle %= 21252;
if (cycle == 0) cycle = 21252;
printf("Case %d: the next triple peak occurs in %d days.\n", n, cycle);
scanf("%d%d%d%d", &p, &e, &i, &d);
}
}
所有能找到的测试数据都用一遍了,都能通过啊!!!
哪位高手给指点一下
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator