money = 800

coins = [500, 400, 100]
min_count = float('inf')

for a in range(money // 500 + 1):
    remaining1 = money - 500 * a
    
    for b in range(remaining1 // 400 + 1):
        remaining2 = remaining1 - 400 * b
        
        if remaining2 % 100 == 0:
            c = remaining2 // 100
            total = a + b + c
            if total < min_count:
                min_count = total

print(min_count)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: