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 ((dir='R') and (Dx>=Bx)) then T:=(abs(Dx-Bx) + abs(Dy-By)) / (Ds+Bs)
  22. else if ((dir='R') and (Dx<=Bx)) then T:=(abs(Dx-Bx) + abs(Dy-By)) / (Ds-Bs);
  23.  
  24. writeLn(round(T));
  25.  
  26. end.
Success #stdin #stdout 0s 5316KB
stdin
3 5 2
10 -3 0
R
stdout
8