
2×n 직사각형을 1×2, 2×1과 2×2 타일로 채우는 방법의 수를 구하기
따라서 점화식은
d[n] = d[n-1] + 2 * d[n-2]
#include <bits/stdc++.h>
using namespace std;
int n;
int d[1005];
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
d[1] = 1; d[2] = 3;
for(int i = 3; i <= n; i++){
d[i] = (d[i-1] + 2*d[i-2])%10007;
}
cout << d[n];
}