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

求证 wrong answer

Posted by 306565318 at 2008-10-15 19:46:56 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
	int p,e,i,d,days=0;
    while(cin>>p>>e>>i>>d)
	{
		if(p<0||e<0||i<0||d<0||p>365||e>365||i>365||d>365)
			break;
		if(p==e&&e==i&&i==d)
		{
			if(d==-1)
			   return 0;
			else
				days=21252;
		}
		else
		{
			while(p>d)
				p-=23;
			while(e>d)
				e-=28;
			while(i>d)
				i-=33;
			while((d-p)%23||(d-e)%28||(d-i)%33)
			{
				d++;
				days++;
			}
			
		}
		cout<<"the next triple peak occurs in "<<days<<" days"<<endl;
		days=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