| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪位帮个忙看看啊,我觉得没错啊,很简单的代码,难道是复杂度的原因?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator