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

求助:1006

Posted by thief at 2007-12-05 11:21:11
大牛们给点Hint吧


代码:
#include <iostream>
using namespace std;
int main()
{
	 int p=0,i=0,e=0,d=0,l=0,n=0;
	while((cin>>p>>e>>i>>d)&&(p!=-1))
	{
		n++;
		p=p%23;e=e%28;i=i%33;
		l=((d+32)/33)*33+i;
		bool found=false;
		if(l==d) l=33+d;
		while(!found)
		{
			if((l%23==p)&&(l%28)==e) found=true;
			else l+=33;
		}
		cout<<"Case "<<n<<": the next triple peak occurs in "<<l-d<<" days."<<endl;
	}
	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