문제

https://www.acmicpc.net/problem/3009


문제 풀이

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
30
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] x = new int[3];
        int[] y = new int[3];
        int xx, yy;

        for (int i = 0; i < 3; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        if (x[1] == x[2]) {
            xx = x[0];
        } else {
            xx = (x[0] == x[1]) ? x[2] : x[1];
        }

        if (y[1] == y[2]) {
            yy = y[0];
        } else {
            yy = (y[0] == y[1]) ? y[2] : y[1];
        }

        System.out.println(xx + " "+ yy);
    }
}

카테고리:

업데이트:

댓글남기기