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。其实暴力也很快,一个case也就算1000次而已~~

Posted by userfriendly at 2008-07-16 21:05:58 on Problem 1006
#include <iostream>
using namespace std;

int main()
{
	int p, e, i, d, k, c=0;
	while(cin>>p>>e>>i>>d && p!=-1)
	{
		c++;
		p%=23; e%=28; i%=33;
		if(p==e && e==i && p>d)
			k=1;
		else do
		{
			p+=23;
			k=p;
		}while(d>=k || (p-e)%28 || (p-i)%33);
		cout<<"Case "<<c<<": the next triple peak occurs in "<<k-d<<" days."<<endl;
	}
}

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