백준 25496번: 장신구 명장 임스 #Python

ColorlessDia·2024년 2월 11일

algorithm/baekjoon

목록 보기
64/811
P, N = map(int, input().split())
A = list(map(int, input().split()))

fatigue = P
count = 0

for a in sorted(A):
    if 200 <= fatigue:
        break

    fatigue += a
    count += 1

print(count)

0개의 댓글