Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.50 KB | None | 0 0
  1. program qq;
  2. var x,y,step:longint;
  3.       ind:boolean;
  4.       count,answ:integer;
  5. begin
  6. x:=0; y:=0;
  7. write(x,' ',y,#13#10);
  8. read(answ);
  9. ind:=true;
  10. step:=1000000000;
  11. while ind do begin
  12. repeat //вверх
  13. if (y+step)<=1000000000 then
  14. y:=y+step;
  15. write(x,' ',y,#13#10);
  16. read(answ);
  17. until answ=0;
  18. if count=2 then begin
  19.                          write('A ',x+1,' ',y-1,#13#10);
  20.                          break;
  21.                          end;
  22. step:=trunc(step/2);
  23. if step<1 then step:=1;
  24. if step=1 then count:=count+1;
  25. repeat //вправо
  26. if (x+step)<=1000000000 then
  27. x:=x+step;
  28. write(x,' ',y,#13#10);
  29. read(answ);
  30. until answ=0;
  31. if count=2 then begin
  32.                          write('A ',x-1,' ',y-1,#13#10);
  33.                          break;
  34.                          end;
  35. step:=trunc(step/2);
  36. if step<1 then step:=1;
  37. if step=1 then count:=count+1;
  38. repeat //вниз
  39. if (y-step)>=0 then
  40. y:=y-step;
  41. write(x,' ',y,#13#10);
  42. read(answ);
  43. until answ=0;
  44. if count=2 then begin
  45.                          write('A ',x-1,' ',y+1,#13#10);
  46.                          break;
  47.                          end;
  48. step:=trunc(step/2);
  49. if step<1 then step:=1;
  50. if step=1 then count:=count+1;
  51. repeat //влево
  52. if (x-step)>=0 then
  53. x:=x-step;
  54. write(x,' ',y,#13#10);
  55. read(answ);
  56. until answ=0;
  57. if count=2 then begin
  58.                          write('A ',x+1,' ',y+1,#13#10);
  59.                          break;
  60.                          end;
  61. step:=trunc(step/2);
  62. if step<1 then step:=1;
  63. if step=1 then count:=count+1;
  64. end;
  65. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement