본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#76 백준 알고리즘 [11047] 동전 0

https://www.acmicpc.net/problem/11047

 

#Solution

coin_num, target_money = map(int, input().split())
coin_list = []
total_coin = 0

for i in range(coin_num):
    coin_list.append(int(input()))

for i in range(1, coin_num+1):
    if target_money // coin_list[-i] > 0:
        total_coin += target_money // coin_list[-i]
        target_money = target_money % coin_list[-i]
        if target_money == 0:
            break
            
print(total_coin)