IT/알고리즘
[백준] 2xn 타일링2
남갯
2024. 11. 18. 20:21
728x90
SMALL
https://www.acmicpc.net/problem/11727
fun main() = with(Scanner(System.`in`)) {
val size = nextInt()
val count = Array<Int>(size + 1) { 0 }
count[0] = 0
count[1] = 1
if(size == 1){
println(count[1])
return
}
count[2] = 3
for (i in 3 until count.size) {
count[i] = (count[i - 2] * 2 + count[i - 1]) % 10007
}
println(count[size])
}
728x90
LIST