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; }
3.1.2. 2×n 타일링 ¶
#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]) % 10007; } cout<<arr[n]<<endl; }
3.2. 박인서 ¶
- 2xn 타일링 2
#include <iostream> int a[1001]; int main() { int n; std::cin >> n; a[1] = 1; a[2] = 3; for (int i = 3; i <= n; i++) { a[i] = (a[i - 1] + a[i - 2] * 2) % 10007; } std::cout << a[n]; return 0; }
- 2xn 타일링
#include <iostream> int a[1001]; int main() { int n; std::cin >> n; a[1] = 1; a[2] = 2; for (int i = 3; i <= n; i++) { a[i] = (a[i - 1] + a[i - 2]) % 10007; } std::cout << a[n]; return 0; }