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

why? 为什么错了?

Posted by zhangcheng at 2005-11-09 18:27:30 on Problem 1006
#include "iostream"
using namespace std;
int max(int a,int b)
{
	if(a>=b)
		return a;
	else 
		return b;
}
int main()
{
	int p,e,i,d;
	int j,k,t=0,sum[1000],temp=0,Max=0;
	while(cin>>p>>e>>i>>d&&(p!=-1||e!=-1||i!=-1||d!=-1))
	{
		temp=max(p,e);
		Max=max(temp,i);
		k=Max;
		t++;
		while(k<=21252+d)
		{
			k++;
			if((k-p)%23==0&&(k-e)%28==0&&(k-i)%33==0)
				break;
		}
		sum[t]=k-d;
	}
	for(j=1;j<=t;j++)
		cout<<"Case "<<j<<": the next triple peak occurs in "<<sum[j]<<" days.\n";
	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