[BOJ] 11726번 : 2 x n 타일링
2024. 8. 31. 15:43ㆍAlgorithm
1. problem :
https://www.acmicpc.net/problem/11726
2. solution 1 :
#include <bits/stdc++.h>
using namespace std;
int n;
int d[1005];
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
d[1] = 1, d[2] = 2;
if (n <= 2) {
cout << d[n] % 10007;
return 0;
}
for (int i = 3; i <= n; i++) d[i] = (d[i - 1] + d[i - 2]) % 10007;
cout << d[n];
}
'Algorithm' 카테고리의 다른 글
[BOJ] 12852번 : 1로 만들기 2 (0) | 2024.08.31 |
---|---|
[BOJ] 11659번 : 구간 합 구하기 4 (0) | 2024.08.31 |
[BOJ] 1149번 : RGB거리 (0) | 2024.08.31 |
[BOJ] 9095번 : 1,2,3 더하기 (0) | 2024.08.31 |
[BOJ] 1463번 : 1로 만들기 (0) | 2024.08.30 |