import java.util.Scanner;
class Main {
static int getNumb() {
Scanner sxy = new Scanner(System.in);
return sxy.nextInt();
}
public static void main(String [ ] args) {
int x1 = getNumb();
int y1 = getNumb();
int x2 = getNumb();
int y2 = getNumb();
String can = "NO";
if((x1 + 1 == x2) || (x1 - 1 == x2) && y1 == y2) {
can = "YES";
}
else if((y1 + 1 == y2) || (y1 - 1 == y2) && x1 == x2) {
can = "YES";
}
else if((x1 + 1 == x2 && y1 + 1 == y2) || (x1 + 1 == x2 && y1 - 1 == y2) || (x1 - 1 == x2 && y1 + 1 == y2) || (x1 - 1 == x2 && y1 - 1 == y2)) {
can = "YES";
}
System.out.print(can);
}
}
1.
program tr;
uses drawman;
procedure t;
begin
PenDown;
OnVector (2,4);
OnVector (2,-4);
OnVector (-4,0);
OnVector (2,0);
PenUp
end;
var i:integer;
begin
Field(12,6);
ToPoint (1,1);
for i:=1 to 4 do t;
ToPoint (0,0);
end.
2.
program lod;
uses drawman;
procedure l;
begin
PenDown;
OnVector (0,2);
OnVector (-1,-2);
OnVector (2,0);
OnVector (-1,2);
OnVector (0,-2);
OnVector (-2,0);
OnVector (1,-1);
OnVector (2,0);
OnVector (1,1);
OnVector (-2,0);
PenUp
end;
begin
Field(12,9);
ToPoint (3,2);
l;
ToPoint (6,6);
l;
ToPoint (9,2);
l;
ToPoint (0,0)
end.
Объяснение:
Смотри картинки

Поделитесь своими знаниями, ответьте на вопрос: