-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP130.java
More file actions
29 lines (25 loc) · 786 Bytes
/
P130.java
File metadata and controls
29 lines (25 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package p100_199;
import java.util.Scanner;
//accepted
public class P130 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int tamanio = sc.nextInt();
while (tamanio!=0){
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
if (x1==x2 && y2==y1){
System.out.println(0);
}else if ((Math.abs(x2-x1)+Math.abs(y2-y1))%2!=0){
System.out.println("IMPOSIBLE");
} else if (Math.abs(x2-x1) == Math.abs(y2-y1)){
System.out.println(1);
} else {
System.out.println(2);
}
tamanio = sc.nextInt();
}
}
}