fork download
  1. program pizzalandia;
  2. var T, test : Longint;
  3. X,Y,Tx,Ty, Wx, Wy, tragittotreno, dist,tempo : Int64;
  4. posizionetreno, newposition: Longint;
  5. begin
  6. readln(T);
  7. for test :=1 to T do
  8. begin
  9. readln(X,Y,Tx,Ty,Wx,Wy);
  10. if ((Tx>Wx) and (Tx<=X)) and ((Ty>=Wy) and (Ty<=Y)) then begin posizionetreno:=1; tragittotreno:= ((X-Tx)+(Ty-Wy)); dist:=tragittotreno-(X-Wx); if Dist>=0 then tempo:=X-Wx+dist
  11. else newposition:=posizionetreno mod 4 +1; end
  12. else if ((Tx>=Wx) and (Tx<=X)) and ((Ty>0) and (Ty<Y)) then begin posizionetreno:=2; tragittotreno:= ((Ty-0)+(Tx-Wx)); dist:=tragittotreno-(Wy-0); if dist>=0 then tempo:=Wy+dist
  13. else newposition:=posizionetreno mod 4 +1; end
  14. else if ((Tx>0) and (Tx<X)) and ((Ty>0) and (Ty<=Wy)) then begin posizionetreno:=3; tragittotreno:= ((Tx-0)+(Wy-Ty)); dist:=tragittotreno-(Wx-0); if dist>=0 then tempo:=Wx+dist
  15. else newposition:=posizionetreno mod 4 +1; end
  16. else if ((Tx>0) and (Tx<=Wx)) and ((Ty>Wy) and (Ty<=Y)) then begin posizionetreno:=4; tragittotreno:= ((Y-Ty)+(Wx-Tx)); dist:=tragittotreno-(Y-Wy); if dist>=0 then tempo:=Y-Wy+dist
  17. else newposition:=posizionetreno mod 4 +1; end;
  18. writeln(tempo);
  19. end;
  20. end.
  21.  
  22. Case Number of
  23. 1..10 : WriteLn ('Small number');
  24. 11..100 : WriteLn ('Normal, medium number');
  25.  
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
Standard output is empty