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 lxp_rs at 2006-07-21 15:59:39 on Problem 1006
#include "stdio.h"
int main()
{
    int i,a,b,c,d,tag=0;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	while(a!=-1&&b!=-1&&c!=-1&&d!=-1)
		{
			tag++;
			for(i=d;;i++)
				{
					if(((i-a)%23==0)&&((i-b)%28==0)&&((i-c)%33==0)) break;
				}
			if(i==d) printf("Case %d: the next triple peak occurs in %d days.\n",tag,i+21252);
			else if(i>21252) printf("Case %d: the next triple peak occurs in %d days.\n",tag,i-21252-d);
			else printf("Case %d: the next triple peak occurs in %d days.\n",tag,i-d);
			scanf("%d%d%d%d",&a,&b,&c,&d);	
		}
	return 0;
}

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