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

Re: 我也觉得应该不会超啊,可我试很多次了,唉。

Posted by Judas at 2005-07-26 08:54:22 on Problem 1006
In Reply To:Re: 我也觉得应该不会超啊,可我试很多次了,唉。 Posted by:Judas at 2005-07-26 08:39:42
Source

Problem Id:1006  User Id:Judas 
Memory:28K  Time:1015MS
Language:C++  Result:Time Limit Exceed

Source 

#include<iostream.h>
int main()
{
	int p=0,e=0,i=0,day=0;
	int n,sum[50],m;
	int j=1;
	while(p != -1)
	{
		cin>>p>>e>>i>>day;if (p==-1) break;
		int d=i;
		while(d<=21252)
		{
			m=d-day;
			if((d-e)%28==0 && (d-p)%23==0) 
			{
				if (m<=0)	m+=21252;
				{
					n=j;sum[j]=m;break;
				}
			}d=p+j*33;
		}
		j++;
	}
	for(j=1;j<=n;j++)
		cout<<"Case "<<j<<": the next triple peak occurs in "<<sum[j]<<" days."<<endl;
	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