50분
기하학, 많은 조건 분기
216ms
- 앞의 조건을 배제해 나가는 if/else if문을 잘 활용하자.
- 따라서, d-c-b-a 순으로 조건을 전개하여야 한다.
- 머리를 막 써야 하는 어려운 문제는 아닌데, 자꾸 조건을 잘못 적어서 틀렸다...ㅎㅎ 우습게 봤다가 자꾸 실수함.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for(int i=0; i<4; i++) {
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int p1 = sc.nextInt();
int q1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
int p2 = sc.nextInt();
int q2 = sc.nextInt();
if(p1<x2 || q1<y2 || q2<y1 || p2<x1) {
System.out.println("d");
} else if ((x1 == p2 && y1 == q2) || (x1 == p2 && q1 == y2) || (p1 == x2 && q1 == y2) || (p1 == x2 && y1 == q2)) {
System.out.println("c");
} else if (x2 == p1 || x1 == p2 || q1 == y2|| q2 == y1) {
System.out.println("b");
} else {
System.out.println("a");
}
}
}
}