Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么总是WA啊????

Posted by lcqbest at 2008-12-09 21:06:46 on Problem 1006
/* 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator