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 213090901 at 2011-04-20 16:41:19 on Problem 1061
#include <iostream>
using namespace std;
int main()
{
	unsigned long maxTimes=1000000;
	int x,y,m,n,l;
	cin>>x>>y>>m>>n>>l;
	unsigned long times;
	for (times=0;times<maxTimes;times++)
	{
		if ( (x+m*times)%l == (y+n*times)%l )
		{
			cout<<times<<endl;
			break;
		}
	}
	if (times==maxTimes)
			cout<<"Impossible"<<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