Skip to content

Commit

Permalink
Merge pull request #170 from AlgoLeadMe/8-H0ngJu
Browse files Browse the repository at this point in the history
8-H0ngJu
  • Loading branch information
H0ngJu authored Apr 11, 2024
2 parents 91b36eb + 13a412a commit 318bf96
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
13 changes: 7 additions & 6 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
## โœ๏ธ ๊ธฐ๋ก

| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
| :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :-------------------------------------------------: |
| 1์ฐจ์‹œ | 2024.03.05 | ํ | [ํ”„๋กœ์„ธ์Šค](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 |
| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
| :---: | :--------: | :------: | :-----------------------------------------------------------------------------------: | :-------------------------------------------------: |
| 1์ฐจ์‹œ | 2024.03.05 | ํ | [ํ”„๋กœ์„ธ์Šค](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 |
| 2์ฐจ์‹œ | 2024.03.07 | ํ | [๋‹ค๋ฆฌ๋ฅผ ์ง€๋‚˜๋Š” ํŠธ๋Ÿญ](https://school.programmers.co.kr/learn/courses/30/lessons/42583) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/153 |
| 3์ฐจ์‹œ | 2024.03.10 | ํž™ | [N๋ฒˆ์งธ ํฐ ์ˆ˜](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 |
| 4์ฐจ์‹œ | 2024.03.13 | ํž™ | [๋ฌธ์ œ์ง‘](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 |
| 5์ฐจ์‹œ | 2024.03.16 | ๊ตฌํ˜„ | [์š”์„ธํ‘ธ์Šค ๋ฌธ์ œ](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 |
| 3์ฐจ์‹œ | 2024.03.10 | ํž™ | [N๋ฒˆ์งธ ํฐ ์ˆ˜](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 |
| 4์ฐจ์‹œ | 2024.03.13 | ํž™ | [๋ฌธ์ œ์ง‘](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 |
| 5์ฐจ์‹œ | 2024.03.16 | ๊ตฌํ˜„ | [์š”์„ธํ‘ธ์Šค ๋ฌธ์ œ](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 |
| 6์ฐจ์‹œ | 2024.03.19 | ์Šคํƒ | [์˜คํฐ์ˆ˜](https://www.acmicpc.net/problem/17298) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/164 |
| 7์ฐจ์‹œ | 2024.03.22 | DP | [1,2,3 ๋”ํ•˜๊ธฐ](https://www.acmicpc.net/problem/9095) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/166 |
| 8์ฐจ์‹œ | 2024.03.16 | DP | [์‰ฌ์šด ๊ณ„๋‹จ ์ˆ˜](https://www.acmicpc.net/problem/10844) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/170 |

---
28 changes: 28 additions & 0 deletions H0ngJu/์‰ฌ์šด ๊ณ„๋‹จ ์ˆ˜.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import sys

DIV = 1_000_000_000

N = int(sys.stdin.readline().rstrip())

dp = [[0] * 10 for _ in range(N+1)]
answer = 0

for i in range(1,N+1):
if i == 1:
for k in range(1,10):
dp[i][k] = 1

else:
for num in range(10):
if num == 0:
dp[i][num] = dp[i-1][1]%DIV
elif num == 9:
dp[i][num] = dp[i-1][8]%DIV
else:
dp[i][num] = (dp[i-1][num-1] + dp[i-1][num+1])%DIV

for k in range(10):
answer += dp[N][k]

print(answer%DIV)

0 comments on commit 318bf96

Please sign in to comment.