728x90
320x100
구현
coins = [500, 100, 50, 10, 5, 1]
money = 1000 - int(input())
cnt = 0
for coin in coins:
cnt += money // coin
money %= coin
print(cnt)
- 그리디 알고리즘 활용
728x90
320x100
'💻 하나씩 차곡차곡 > 백준알고리즘 (Python,Java)' 카테고리의 다른 글
백준 1461번 파이썬 (0) | 2024.12.11 |
---|---|
백준 1026번 파이썬 (0) | 2024.12.10 |
백준 1182번 파이썬 (0) | 2024.11.14 |
백준 23246번 파이썬 (0) | 2024.10.15 |
백준 11650번 파이썬 (0) | 2024.10.14 |