| ||||||||||
| 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"
#include "cmath"
using namespace std;
#define ABS(a) ((a)>=0?(a):-(a))
int main()
{
int x,y,m,n,L;
cin>>x>>y>>m>>n>>L;
int steps=0;
if(x==y||((x-y+L)%L)%ABS(m-n))
{
cout<<"Impossible";
}
else
{
do {
++steps;
} while((x+=m)%L!=(y+=n)%L);
cout<<steps<<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