Skip to content

Commit

Permalink
22-yuyu0830
Browse files Browse the repository at this point in the history
22-yuyu0830
  • Loading branch information
yuyu0830 authored Aug 17, 2024
2 parents e8cee2a + de1eebe commit 6b93228
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions yuyu0830/DP/1562.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <iostream>

#define MOD 1000000000

using namespace std;

int arr[101][10][1024] = {0, };

int main() {
int n; cin >> n;

for (int i = 1; i < 10; i++) {
arr[1][i][1 << i] = 1;
}

for (int i = 2; i <= n; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 1024; k++) {
if (j) {
arr[i][j][k | (1 << j)] += arr[i - 1][j - 1][k];
arr[i][j][k | (1 << j)] %= MOD;
}

if (j != 9) {
arr[i][j][k | (1 << j)] += arr[i - 1][j + 1][k];
arr[i][j][k | (1 << j)] %= MOD;
}
}
}
}

int ans = 0;

for (int i = 0; i < 10; i++) {
ans += arr[n][i][1023];
ans %= MOD;
}

printf("%d\n", ans);
}
1 change: 1 addition & 0 deletions yuyu0830/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
| 19์ฐจ์‹œ | 2024.07.12 | ์žฌ๊ท€ | [์šฐ์ˆ˜๋งˆ์„](https://www.acmicpc.net/problem/1949) | - |
| 20์ฐจ์‹œ | 2024.07.22 | LIS | [๊ฐ€์žฅ ๊ธด ์ฆ๊ฐ€ํ•˜๋Š” ๋ถ€๋ถ„ ์ˆ˜์—ด 5](https://www.acmicpc.net/problem/14003) | - |
| 21์ฐจ์‹œ | 2024.07.23 | ์ˆ˜ํ•™ | [1์˜ ๊ฐœ์ˆ˜ ์„ธ๊ธฐ](https://www.acmicpc.net/problem/9527) | - |
| 22์ฐจ์‹œ | 2024.08.05 | DP | [๊ณ„๋‹จ ์ˆ˜](https://www.acmicpc.net/problem/1562) | - |
| 23์ฐจ์‹œ | 2024.08.05 | LCS | [LCS 2](https://www.acmicpc.net/problem/9252) | - |
---

0 comments on commit 6b93228

Please sign in to comment.