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 zhqtry at 2008-04-28 19:57:02 on Problem 1006
#include<stdio.h>

#define MAX 1000

int main()
{
	int x,p,e,q,d;
	int i,k,s[MAX];

	k=1;
	while (true)
	{
		scanf("%d%d%d%d",&p,&e,&q,&d);
		if ((p==-1)&&(e=-1)&&(q=-1)&&(d=-1)) break;
		p=p%23;
		e=e%28;
		q=q%33;

		x=0;
		while (p+23*x<=21252)
		{
			if (((23*x+p-e)%28==0)&&((23*x+p-q)%33==0)&&(p+23*x>=d)) break;
			x++;
		}
		s[k]=p+23*x-d;
		k++;
	}
	for (i=1;i<k;i++)
		printf("Case %d: the next triple peak occurs in %d days.\n",i,s[i]);
	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