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

Re:青蛙的约会 怎么算啊

Posted by 0906401017 at 2010-05-03 15:56:53
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:
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