Skip to content

Commit

Permalink
Merge pull request #139 from AlgoLeadMe/39-tgyuuAn
Browse files Browse the repository at this point in the history
39-tgyuuAn
  • Loading branch information
tgyuuAn authored Mar 4, 2024
2 parents d936df1 + d61cb7e commit 68f3286
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tgyuuAn/DP/์•ฑ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
total_app_count, need_memory = map(int,input().split())

use_memory = list(map(int,input().split()))
re_use_cost = list(map(int,input().split()))

dp_table = [0 for _ in range(sum(re_use_cost)+1)]
cost_sum = sum(re_use_cost)

for memory, cost in zip(use_memory, re_use_cost):
for idx in range(cost_sum,cost-1,-1):
dp_table[idx] = max(dp_table[idx], dp_table[idx-cost] + memory)

for idx, memory in enumerate(dp_table):
if memory >= need_memory:
print(idx)
break
1 change: 1 addition & 0 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
| 36์ฐจ์‹œ | 2023.02.04 | BFS | <a href="https://www.acmicpc.net/problem/4991">๋กœ๋ด‡ ์ฒญ์†Œ๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/126
| 37์ฐจ์‹œ | 2023.02.04 | BFS | <a href="https://www.acmicpc.net/problem/1039">๊ตํ™˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/131
| 38์ฐจ์‹œ | 2023.02.15 | DP | <a href="https://www.acmicpc.net/problem/2749">ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜ 3</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137
| 39์ฐจ์‹œ | 2023.02.18 | DP | <a href="https://www.acmicpc.net/problem/7579">์•ฑ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/139
---

0 comments on commit 68f3286

Please sign in to comment.