Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.51 KB | None | 0 0
  1. program AA;
  2.  
  3. var
  4.   x, y, n, m: longint;
  5. begin
  6.   readln(m, n);
  7.   readln(x, y);
  8.  
  9.   if (n > 1) then
  10.     if (y = 1) then
  11.       writeln(x, ' ', y + 1)
  12.     else if y = n then
  13.       writeln(x, ' ', y - 1)
  14.     else
  15.     begin
  16.       writeln(x, ' ', y - 1);
  17.       writeln(x, ' ', y + 1);
  18.     end;
  19.   if m > 1 then
  20.     if x = 1 then
  21.       writeln(x + 1, ' ', y)
  22.     else if x = m then
  23.       writeln(x - 1, ' ', y)
  24.     else
  25.     begin
  26.       writeln(x - 1, ' ', y);
  27.       writeln(x + 1, ' ', y);
  28.     end;
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement