Home 백준 - 2480 주사위 세개
Post
Cancel

백준 - 2480 주사위 세개

문제

2480 주사위 세개

screencapture

kotlin code

1
2
3
4
5
6
7
8
9
10
11
12
import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    q2480(nextInt(), nextInt(), nextInt());
}

fun q2480(one: Int, two: Int, three: Int): Unit {
    var numMap = listOf(one, two, three).groupingBy { it }.eachCount();
    if(numMap.count() == 1) println(10000 + (numMap.keys.first() * 1000))
    else if(numMap.count() == 2) println(1000 + (numMap.filter { num -> num.value == 2 }.keys.first() * 100))
    else println(numMap.keys.maxOf { it } * 100)
}
This post is licensed under CC BY 4.0 by the author.

백준 - 10952 A+B - 5

백준 - 18108 1998년생인 내가 태국에서는 2541년생?!