Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16-Redish03 #68

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Redish03/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"files.associations": {
"iostream": "cpp",
"algorithm": "cpp"
"algorithm": "cpp",
"vector": "cpp"
}
}
47 changes: 47 additions & 0 deletions Redish03/DP/10844.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <iostream>
#define DVD 1000000000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν˜Ήμ‹œ DVDμ—λŠ” 뜻이 λ”°λ‘œ μžˆλ‚˜μš”???

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ•„λ§ˆ Dividend(ν”Όμ œμˆ˜, λ‚˜λˆ”λ‹Ήν•˜λŠ” 수)λ₯Ό μ˜λ―Έν•΄μ„œ DVD라 지은 게 μ•„λ‹κΉŒ... μ‹Άλ„€μš”

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

divide λ§žμŠ΅λ‹ˆλ‹€γ…
ㅏ

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

divideμ˜€κ΅°!


using namespace std;

int N;

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

int main()
{
cin >> N;
for (int i = 1; i < 10; i++)
{
dp[1][i] = 1;
}
for (int i = 2; i <= N; i++)
{
for (int j = 0; j <= 9; j++)
{
if (j == 0)
{
dp[i][j] = dp[i - 1][1];
}
else if (j == 9)
{
dp[i][j] = dp[i - 1][8];
}
else
{
dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j + 1]);
}
dp[i][j] %= DVD;
}
}

for (int i = 0; i < 10; i++)
{
number_cnt += dp[N][i];
number_cnt %= DVD;
}

cout << number_cnt;
}
1 change: 1 addition & 0 deletions Redish03/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
| 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) |

---