• Home
  • About
    • Moon photo

      Moon

      개발자는 자고 싶다.

    • Learn More
    • Twitter
    • Facebook
    • Instagram
    • Github
    • Steam
  • Posts
    • All Posts
    • All Tags
  • Projects

백준 - 2480 주사위 세개

07 Jun 2022

Reading time ~1 minute

문제

2480 주사위 세개

screencapture

답

kotlin code

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)
}


baekjoonkotlin코틀린백준브론즈수학사칙연산 Share Tweet +1