Algorithm/백준
[백준] 거스름돈 - 파이썬
potato_pizza
2024. 6. 20. 17:16
728x90
거스름돈
https://www.acmicpc.net/problem/5585
문제
코드
# 거스름돈
# 5585
import sys
input = sys.stdin.readline
N = int(input())
exchange = 1000 - N
moneys = [500, 100, 50, 10, 5, 1]
result = 0
for i in moneys:
if exchange == 0:
break
result += exchange // i
exchange %= i
print(result)
728x90
반응형