| ||||||||||
| 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 | |||||||||
Re:青蛙的约会 怎么算啊In Reply To:青蛙的约会 怎么算啊 Posted by:1050205076 at 2006-07-03 15:16:19 > #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