Notice
Recent Posts
Recent Comments
Link
Little Jay
[C++] 백준 13303번 - 타일 장식물 본문
dp 시작
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
long long dp[85];
int n;
int main() {
cin >> n;
dp[0] = 0;
dp[1] = 1;
for (int i = 2; i <= n; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
cout << (dp[n] + dp[n - 1]) * 2 + (dp[n]) * 2 << endl;
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 1744번 - 수 묶기 (0) | 2022.02.11 |
|---|---|
| [C++] 백준 15312번 - 이름 궁합 (0) | 2022.02.06 |
| [C++] 백준 7662번 - 이중 우선순위 큐(multiset) (0) | 2022.01.13 |
| [C++] 백준 1302번 - 베스트셀러 (0) | 2022.01.11 |
| [C++] 백준 2468번 - 안전영역 (0) | 2021.11.19 |
Comments