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 00448083 at 2005-03-12 15:27:13 on Problem 1006
//1006
#include<iostream.h>
void main()
{
	int num=0, t;
	int p, e, i, d;
	while(1)
	{
		cin>>p>>e>>i>>d;
		if((p==-1)&&(e==-1)&&(i==-1)&&(d==-1))
			break;
		num++;
		int j,m=0;
		for(j=1; j<650; j++)
		{
			t=j*33+i;
			if((t-p)%23==0&&(t-e)%28==0)
			{
				t-=d;
				cout<<"case "<<num<<": the next triple peak occurs in ";
				if(t<=0)
					cout<<t+21252;
				else
					cout<<t;
				cout<<" days.";
				cout<<endl;
				break;
			}
		}
	}
}

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