Skip to content

Commit

Permalink
75-tgyuuan
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Sep 3, 2024
1 parent 39a3ee2 commit 9881f68
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tgyuuAn/DP/์‚ฐ ๋ชจ์–‘ ํƒ€์ผ๋ง.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def solution(n, tops):
top = set()
DIV = 10_007

count = 0
for idx, element in enumerate(tops):
if element==1:
count += 1
top.add(2*(idx+1)+count)

DP = [0 for _ in range((n*2)+1+count+1)]
DP[1] = 1
DP[2] = 2

for now_idx in range(3,len(DP)):
if (now_idx-1) in top: DP[now_idx] = (DP[now_idx-3] % DIV) + (DP[now_idx-1] % DIV) % DIV
else: DP[now_idx] = (DP[now_idx-2] % DIV) + (DP[now_idx-1] % DIV) % DIV

return DP[-1] % DIV
1 change: 1 addition & 0 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@
| 70์ฐจ์‹œ | 2024.08.16 | ์Šคํƒ | <a href="https://www.acmicpc.net/problem/22866">ํƒ‘ ๋ณด๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/232
| 71์ฐจ์‹œ | 2024.08.20 | ๋‹ค์ต์ŠคํŠธ๋ผ | <a href="https://www.acmicpc.net/problem/24042">๋‹ค์ต์ŠคํŠธ๋ผ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/235
| 72์ฐจ์‹œ | 2024.08.23 | DFS + ํŠธ๋ฆฌ | <a href="https://www.acmicpc.net/problem/20188">๋“ฑ์‚ฐ ๋งˆ๋‹ˆ์•„</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/238
| 75์ฐจ์‹œ | 2024.09.02 | DP | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/258705">์‚ฐ ๋ชจ์–‘ ํƒ€์ผ๋ง</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/243
---

0 comments on commit 9881f68

Please sign in to comment.