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

我哪里有错?帮帮我

Posted by asdfdsa at 2008-05-01 21:21:24 on Problem 1061
rogram qingwa2;
Var
  x, y, l, m, n, i, ca: Longint;
Begin
  Readln(x, y, m, n, l);
  ca := x - y;
  If  (x <> y) And (m = n) Then Writeln('Impossible');
  If m<n Then Begin
    i := 1;
    While (ca + i * l) Mod (n - m) <> 0 Do Begin
      i := i + 1;
      If i - 1 > n - m Then Begin
        Writeln('Impossible');
        Exit;
      End;
    End;
  End Else Begin
    i := 1;
    While (ca + i * l) Mod (n - m) <> 0 Do Begin
      i := i - 1;
      If i + 1 < n - m Then Begin
        Writeln('Impossible');
        Exit;
      End;
    End;
  End;
  Writeln(abs((ca + i * l) Div (m - n)));
End.

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