3009 네 번째 점

June·2022년 6월 1일

[코딩 연습] BAEKJOON

목록 보기
2/16

문제

3009 네 번째 점

3009 네 번째 점

kotlin code

fun main() {
    val lines = Array(3) { readln().split(" ").map { it.toInt() }.toPair() }

    val x = lines.map { it.first }.groupingBy { it }.eachCount().filter { it.value == 1 }.keys.first()
    val y = lines.map { it.second }.groupingBy { it }.eachCount().filter { it.value == 1 }.keys.first()

    println("$x $y")
}

fun <T> List<T>.toPair(): Pair<T, T> = Pair(this[0], this[1])

0개의 댓글