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 fanxl at 2004-01-06 02:15:28 on Problem 1006
#include <iostream.h>
#include <stdlib.h>
void main()
{
	int p,e,i,d,count=1,t;
	cin>>p>>e>>i>>d;
	if(p>365||e>356||i>365||d>365||p<0||e<0||i<0||d<0)
		exit(0);
	while(p!=-1&&e!=-1&&i!=-1&&d!=-1)
	{
		p=p%365;e=e%365;i=i%365;
		t=23;
		if(t<p)
			t=p+1;
		while((t-p)%23!=0)
		{t++;}
		while((t-e)%28!=0)
			t=t+23;
		while((t-i)%33!=0)
			t=t+23*28;
		t=t-d;
		if(t<=0)
			t=t+21252;
		if(t>21252)
			t=t%21252;
		cout<<"Case "<<count<<": the next triple peak occurs in "<<t<<" days."<<endl;	
		count++;
		cin>>p>>e>>i>>d;
		if(p>365||e>356||i>365||d>365||p<0||e<0||i<0||d<0)
			exit(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