| ||||||||||
| 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 x,y,m,n,L;
unsigned long k=0;
unsigned long x1,y1;
cin>>x>>y>>m>>n>>L;
x1=x;
y1=y;
if(x!=y&&m==n)
{
cout<<"Impossible"<<endl;
return 0;
}
while(x!=y)
{
x=x+m;
if(x>=L)
x=x%L;
y=y+n;
if(y>=L)
y=y%L;
if(x==x1&&y==y1)
{
cout<<"Impossible"<<endl;
return 0;
}
k++;
}
cout<<k<<endl;
return 1;
}
说是Time Limit Exceeded了,高手帮看看。
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator