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

请教为什么我的程序会Time Limit Exceed

Posted by dfyao at 2004-01-06 10:53:44 on Problem 1006
请教为什么我的程序会Time Limit Exceed。这种简单运算怎么会超过1秒的运行时间,在本机上是很快的。做测试时,有什么注意事项吗?

万分感谢!

代码如下:

#include <stdio.h>

int main ()
{
	int		i;
	int		np,ne,ni,nd;

	i=0;
	while (1)
	{
		scanf("%d %d %d %d", &np, &ne, &ni, &nd);
		if ( (np==-1) || (ne==-1) || (ni==-1) || (nd==-1) )
			break;
		while (1)
		{
			np += 23;
			if (np>21252)
				np -= 21252;
			if ( (np>ne) && (np>ni) && 
				((np-ne)%28 == 0) && ((np-ni)%33 == 0) )
				break;
		}
		printf("Case %d: the next triple peak occurs in %d days.\n\n", i+1, np-nd );
		i++;
	}

	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