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 e10101 at 2008-11-29 15:08:57 on Problem 1061
#include <stdio.h>
int main()
{
	unsigned long int x,y,m,n,L;
	unsigned long int sum1,sum2;
	unsigned int flag=0,i;
	scanf("%d%d%d%d%d",&x,&y,&m,&n,&L);
	for(sum1=x,sum2=y,i=1;i<L;i++)
	{
		sum1+=m;
		sum2+=n;
		sum1%=L;
		sum2%=L;
		if(sum1==sum2)
		{
			flag=1;
			break;
		}
	}
	if(flag)
		printf("%d\n",i);
	else
		printf("Impossible\n");
}

----------
一直提醒超时,高手指教!不胜感激

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