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 Judas at 2005-07-25 20:44:16 on Problem 1006
#include<iostream.h>
#include<math.h>
void main()
{
	int p=0,e=0,i=0,day=0;
	int n,sum[100];
	for(int j=1;p != -1 && e != -1 && i != -1 && day != -1;j++)
	{
		cin>>p>>e>>i>>day;if (p==-1) break;
		for(int d=i;d<=21252;d+=33)
		{
			if(fmod(d-e,28)!=0) continue;
			else if(fmod(d-p,23)!=0) continue;
			else
			{
				if (d-day>0)
				{
					n=j;sum[j]=d-day;break;
				}
			}
		}
	}
	for(j=1;j<=n;j++)
		cout<<"Case "<<j<<": the next triple peak occurs in "<<sum[j]<<" days."<<endl;
				
}

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