← Back to List

25496번: 장신구 명장 임스 ↗

Solutions

Python 3
150 B | 150 chars
p, n = map(int, input().split())
l = sorted([*map(int, input().split())])
idx = 0
while p < 200 and idx < n:
    p += l[idx]
    idx += 1

print(idx)