fork download
  1. program chasing;
  2. Uses Math;
  3.  
  4. var
  5. Bs, Bx, By, Ds, Dx, Dy : LongInt;
  6. dir : Char;
  7. T : real;
  8. begin
  9.  
  10. (*assign(input, 'input.txt'); reset(input);
  11.   assign(output, 'output.txt'); rewrite(output);*)
  12.  
  13. ReadLn(Dx, Dy, Ds);
  14.  
  15. ReadLn(Bx, By, Bs);
  16.  
  17. ReadLn(dir);
  18.  
  19. T := 0;
  20.  
  21. if ((Bs=0) and (Ds<>0)) then begin T:=(abs(Dx-Bx) + abs(Dy-By)) / Ds; WriteLn(round(T));end
  22. else if ((Bs=0) and (Ds=0)) then writeln(-1);
  23.  
  24.  
  25.  
  26. end.
Success #stdin #stdout 0s 5288KB
stdin
3 5 2
10 -3 0
R
stdout
8