Home 백준 - 2164 카드2
Post
Cancel

백준 - 2164 카드2

문제

2164 카드2

screencapture

kotlin code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fun main() {
    q2164()
}

fun q2164() {
    val cards = java.util.LinkedList<Int>()
    for(i in 1.. readln().toInt()) {
        cards.add(i)
    }
    
    while (cards.count() > 2) {
        cards.removeFirst()
        cards.addLast(cards.removeFirst())
    }
    println(cards.last)
}
This post is licensed under CC BY 4.0 by the author.

백준 - 11866 오세푸스 문제 0

백준 - 1316 그룹 단어 체커