diff --git a/yoonjin/0901/1106.py b/yoonjin/0901/1106.py new file mode 100644 index 0000000..ab9f650 --- /dev/null +++ b/yoonjin/0901/1106.py @@ -0,0 +1,18 @@ +import sys +input = sys.stdin.readline + +c, n = map(int, input().split()) +cost_list = [] + +for i in range(n): + cost, people = map(int, input().split()) + cost_list.append([cost, people]) + +dp = [1e7 for _ in range(c+100)] #최댓값이 100 +dp[0] = 0 + +for cost, people in cost_list: + for i in range(people, c+100): + dp[i] = min(dp[i-people]+cost,dp[i]) + +print(min(dp[c:]))