diff --git "a/tgyuuAn/DP/\354\225\261.py" "b/tgyuuAn/DP/\354\225\261.py" new file mode 100644 index 00000000..a362acdc --- /dev/null +++ "b/tgyuuAn/DP/\354\225\261.py" @@ -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 \ No newline at end of file diff --git a/tgyuuAn/README.md b/tgyuuAn/README.md index 65a108f7..88d539c4 100644 --- a/tgyuuAn/README.md +++ b/tgyuuAn/README.md @@ -40,4 +40,5 @@ | 36차시 | 2023.02.04 | BFS | 로봇 청소기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/126 | 37차시 | 2023.02.04 | BFS | 교환 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/131 | 38차시 | 2023.02.15 | DP | 피보나치 수 3 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137 +| 39차시 | 2023.02.18 | DP | | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/139 ---