3.1.1. 2×n 타일링 2 ¶
#include<iostream> using namespace std; int arr[1100] = { 0, }; int main(){ arr[0] = 1; arr[1] = 1; int n, ans; cin>> n; for(int i = 2; i<=n; i++){ arr[i] = (arr[i-1] + arr[i-2] * 2) % 10007; } cout<<arr[n]<<endl; }
#include<iostream> using namespace std; int arr[1100] = { 0, }; int main(){ arr[0] = 1; arr[1] = 1; int n, ans; cin>> n; for(int i = 2; i<=n; i++){ arr[i] = (arr[i-1] + arr[i-2] * 2) % 10007; } cout<<arr[n]<<endl; }