백준 문제/DP
[백준] 11727번 2xn 타일링 2
dubu0721
2025. 2. 16. 16:10
basic-algo-lecture/workbook/0x10.md at master · encrypted-def/basic-algo-lecture
basic-algo-lecture/workbook/0x10.md at master · encrypted-def/basic-algo-lecture
바킹독의 실전 알고리즘 강의 자료. Contribute to encrypted-def/basic-algo-lecture development by creating an account on GitHub.
github.com
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
//#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> table(n + 1);
table[1] = 1; // 2x1
if (n>=2)
table[2] = 3; // 2x2, 2x1 + 2x1, 1x2 + 1x2
for (int i = 3; i < n + 1; i++) {
table[i] = (table[i - 1] + (2 * table[i - 2])) % 10007;
}
cout << table[n] % 10007;
return 0;
}
자꾸 10007 로 나누는 걸 깜빡해서 틀린다;; 문제 제대로 읽어야 하는데..;;