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

为什么总是超时,有没有别的测试数据?哪位C++高手指点一下,谢谢

Posted by alpc0637 at 2008-02-06 12:18:00
#include<iostream.h>
int main()
{
	int x,y,m,n,l,i;
	cin>>x>>y>>m>>n>>l;
	i=0;
	if(x!=y&&m==n)
	{
		cout<<"Impossible";
		return 0;
	}
	while(x!=y)
	{
		x+=m;
		y+=n;
		while(x>l)
			x-=l;
		while(y>l)
			y-=l;
		i++;
	}
	cout<<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