Home 백준 - 5622 다이얼
Post
Cancel

백준 - 5622 다이얼

문제

5622 다이얼

screencapture

kotlin code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fun main() {
    q5622()
}

fun q5622() {
    val inputs = readln().toCharArray()
    var result = 0
    for(ch in inputs) when(ch) {
        'A', 'B', 'C' -> result += 3
        'D', 'E', 'F' -> result += 4
        'G', 'H', 'I' -> result += 5
        'J', 'K', 'L' -> result += 6
        'M', 'N', 'O' -> result += 7
        'P', 'Q', 'R', 'S' -> result += 8
        'T', 'U', 'V' -> result += 9
        'W', 'X', 'Y', 'Z' -> result += 10
    }

    println(result)
}
This post is licensed under CC BY 4.0 by the author.

백준 - 10250 ACM 호텔

백준 - 1874 스택 수열