# 25496 장신구 명장 임스 실5
p,n = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort()
# print(arr)
i = 0
cnt = 0
while p < 200:
p += arr[i]
i += 1
cnt += 1
if i == n-1:
break
print(cnt)
실수
틀렸습니다 . 50%
n-1으로 둠
# 25496 장신구 명장 임스 실5
p,n = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort()
# print(arr)
i = 0
cnt = 0
while p < 200:
p += arr[i]
i += 1
cnt += 1
if i == n-1:
break
print(cnt)
'알고리즘 문제풀이' 카테고리의 다른 글
백준 2960 에라토스테네스의 체 Python 수학 소수 실버4 (1) | 2024.03.15 |
---|---|
백준 1418 K-세준수 Python 수학 소수 브루트포스 (0) | 2024.03.14 |
백준 8979 올림픽 Python 구현 정렬 실버5 (0) | 2024.03.13 |
백준 1652. 누울 자리를 찾아라 Python 구현 문자열 실버5 (0) | 2024.03.12 |
백준 1978 소수찾기 Python 수학 소수 브론즈2 (1) | 2024.03.12 |