Skip to content

Commit

Permalink
2024-02-18
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 17, 2024
1 parent af790fe commit 7dcc2d6
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 @@ -39,4 +39,5 @@
| 35์ฐจ์‹œ | 2023.01.25 | ์ด๋ถ„ ํƒ์ƒ‰ | <a href="https://www.acmicpc.net/problem/2110">๊ณต์œ ๊ธฐ ์„ค์น˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/120
| 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.18 | DP | <a href="https://www.acmicpc.net/problem/7579">์•ฑ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/139
---

0 comments on commit 7dcc2d6

Please sign in to comment.