문제
2164 카드2
답
kotlin code
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)
}