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

救命啊!错了好多次了,实在不知道错在哪里。

Posted by shangmin at 2005-08-26 18:17:36 on Problem 1006
我自己测了好多都是正确的,各位高手帮忙看看啊!先谢谢了。

#include<stdio.h>
int main()
{
	int p,e,i,d,count;
	count=1;
	while(1)
	{
		scanf("%d%d%d%d",&p,&e,&i,&d);
		if(p==-1)
			break;
		p=p%23;
		e=e%28;
		i=i%33;
		while(1)
		{
		  if(p<=e&&p<=i)
			p=p+23;
		  else
			if(e<=p&&e<=i)
		    	e=e+28;
		    	else
			    	i=i+33;
	    	if(p==e&&e==i&&p>d)
			{
		        printf("Case %d: the next triple peak occurs in %d days.\n",count,p-d);
		        count++;
		        break;
			}
		}
	}
	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