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 tangguowupan at 2012-05-22 20:13:36
//tangguowu

#include <iostream>
using namespace std;

int main()
{
	int p,e,i,d,num=0,j;
	while(cin>>p>>e>>i>>d&&(p!=-1||e!=-1||i!=-1||d!=-1))
	{
		num++;
		for(j=d+1;j>=0;j++)
			if((j+d-p)%23==0 && (j+d-e)%28==0 && (j+d-i)%33==0 )
			{
				cout<<"Case "<<num<<": the next triple peak occurs in "<<j<<" days."<<endl;
				break;
			}
	}
	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