알고리즘/백준

백준-11047번(동전 0)-python3

nyeongha 2023. 11. 30. 18:59
import sys
a,b=map(int,sys.stdin.readline().split())
coin=[]
cnt=0
for x in range(a):
    coin.append(int(sys.stdin.readline()))

for x in reversed(coin):
    if b>=x:
        cnt+=b//x
        b=b%x
print(cnt)
저작자표시 비영리 변경금지 (새창열림)