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

在你之前我pass了,不过还要谢谢你

Posted by winacm at 2005-09-19 13:01:11 on Problem 1006
In Reply To:你这样做会超时 Posted by:number at 2005-09-19 12:57:54
> #include<iostream>

using namespace std;

int main()
{
	int p,e,i,d;
	int k,t=0;

	while(cin>>p>>e>>i>>d&&(p!=-1||e!=-1||i!=-1||d!=-1))
	{
		p=p%23;e=e%28;i=i%33;
		k=d;
		t++;
		while(k<=21252+d)
		{
			k++;
			if((k-p)%23==0&&(k-e)%28==0&&(k-i)%33==0)
			{
				break;
			}
		}
		cout<<"Case "<<t<<": the next triple peak occurs in "<<k-d<<" days.\n";
	}
	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