
-Code
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class BOJ3009 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] xArr = new int[3];
int[] yArr = new int[3];
for (int i = 0; i < 3; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
xArr[i] = x;
yArr[i] = y;
}
System.out.println(solution(xArr) + " " + solution(yArr));
}
private static int solution(int[] arr) {
if (arr[0] == arr[1]) return arr[2];
return arr[1] == arr[2] ? arr[0] : arr[1];
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 2446번 별 찍기 - 9 (0) | 2025.12.19 |
|---|---|
| [백준/Java] 11719번 그대로 출력하기 2 (0) | 2025.12.19 |
| [백준/Java] 2442번 별 찍기 - 5 (0) | 2025.12.19 |
| [백준/Java] 6795번 Up and Down (0) | 2025.12.19 |
| [백준/Java] 31497번 생일 축하합니다~ (0) | 2025.12.18 |