Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- JPA
- GCP
- dfs
- dynamic debugging
- java
- OS
- ๊ตฌํ
- ์ฐ์ ์์ ํ
- ๋งต
- ๋์ ํฉ
- ์์ ์ ๋ ฌ
- ์ฌ๊ท
- ๋ฌธ์์ด
- ์ด๋ถ ํ์
- ๊ทธ๋ฆฌ๋
- DP
- ๋ฐ์ดํฌ์คํธ๋ผ
- ๋ถํ ์ ๋ณต
- Spring
- c++
- Reversing
- thymeleaf
- ์คํ
- error
- web
- CVE
- BFS
- ์๋ฎฌ๋ ์ด์
- ๋ฐฑํธ๋ํน
- ์ต๋จ ๊ฒฝ๋ก
Archives
- Today
- Total
hades
[Baekjoon] 11726๋ฒ: 2xn ํ์ผ๋ง ๋ณธ๋ฌธ
๐ฅ ๋ฌธ์
https://www.acmicpc.net/problem/11726
๐ ์ค๊ณ
์ง์ ๊ทธ๋ ค์ ํ์ ํด๋ณด๋ฉด, ํ๋์ ํ์ดํ๋ 2*1 ํ์ผ์ ์ถ๊ฐํ์ฌ ๋ง๋ค์ด์ง๊ณ , ๋นจ๊ฐ์ ํ์ดํ๋ 1*2 ํ์ผ์ ๋ ๊ฐ ๋ถ์ธ ๊ฒ์ ์ถ๊ฐํ์ฌ ๋ง๋ค์ด์ง๋ค.
์ฆ, dp[i] = dp[i-1] + dp[i-2]๋ผ๋ ๊ฒ์ ์ ์ ์๋ค.
๐ ํ์ด
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int n;
vector<int> dp(1001);
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
dp[i] %= 10007;
}
cout << dp[n] << "\n";
return 0;
}
'๐ PS > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Baekjoon] 17626๋ฒ: Four Squares (0) | 2024.07.29 |
---|---|
[Baekjoon] 14500๋ฒ: ํ ํธ๋ก๋ฏธ๋ ธ (1) | 2024.07.26 |
[Baekjoon] 11724๋ฒ: ์ฐ๊ฒฐ ์์์ ๊ฐ์ (0) | 2024.07.25 |
[Baekjoon] 11659๋ฒ: ๊ตฌ๊ฐ ํฉ ๊ตฌํ๊ธฐ (0) | 2024.07.25 |
[Baekjoon] 11403๋ฒ: ๊ฒฝ๋ก ์ฐพ๊ธฐ (0) | 2024.07.25 |