Skip to content

Commit

Permalink
Merge pull request #73 from AlgoLeadMe/17-Redish03
Browse files Browse the repository at this point in the history
17-Redish03
  • Loading branch information
Redish03 committed Mar 6, 2024
2 parents 014f1c9 + 7ade3ed commit aaa6407
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
39 changes: 39 additions & 0 deletions Redish03/DP/9461.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <iostream>

using namespace std;

long long dp[101] = {
0,
};

long long rec(int N)
{
if (dp[N] != 0)
{
return dp[N];
}
if (N == 1 || N == 2 || N == 3)
{
dp[N] = 1;
return 1;
}

dp[N] = rec(N - 2) + rec(N - 3);
return dp[N];
}

int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

int T, N;
cin >> T;

for (int i = 0; i < T; i++)
{
cin >> N;
cout << rec(N) << '\n';
}
}
5 changes: 3 additions & 2 deletions Redish03/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
| 12์ฐจ์‹œ | 2024.02.03 | DP | [๊ตฌ๊ฐ„ ํ•ฉ ๊ตฌํ•˜๊ธฐ 5](https://www.acmicpc.net/problem/11660) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/47) |
| 13์ฐจ์‹œ | 2024.02.06 | Back tracking | [N๊ณผ M(9)](https://www.acmicpc.net/problem/15663) | [#13](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/52) |
| 14์ฐจ์‹œ | 2024.02.12 | KnapSack(DP) | [ํ‰๋ฒ”ํ•œ ๋ฐฐ๋‚ญ](https://www.acmicpc.net/problem/12865) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/55) |
| 15์ฐจ์‹œ | 2024.02.15 | DFS | [ํŠธ๋ฆฌ์˜ ์ง€๋ฆ„](https://www.acmicpc.net/problem/1167) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/55) |
| 16์ฐจ์‹œ | 2024.02.27 | DP | [์‰ฌ์šด ๊ณ„๋‹จ ์ˆ˜](https://www.acmicpc.net/problem/10844) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/68) |
| 15์ฐจ์‹œ | 2024.02.15 | DFS | [ํŠธ๋ฆฌ์˜ ์ง€๋ฆ„](https://www.acmicpc.net/problem/1167) | [#15](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/55) |
| 16์ฐจ์‹œ | 2024.02.27 | DP | [์‰ฌ์šด ๊ณ„๋‹จ ์ˆ˜](https://www.acmicpc.net/problem/10844) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/68) |
| 17์ฐจ์‹œ | 2024.03.01 | DP | [ํŒŒ๋„๋ฐ˜ ์ˆ˜์—ด](https://www.acmicpc.net/problem/9461) | [#17](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/68) |

---

0 comments on commit aaa6407

Please sign in to comment.