
문제 5585번: 거스름돈 타로는 자주 JOI잡화점에서 물건을 산다. JOI잡화점에는 잔돈으로 500엔, 100엔, 50엔, 10엔, 5엔, 1엔이 충분히 있고, 언제나 거스름돈 개수가 가장 적게 잔돈을 준다. 타로가 JOI잡화점에서 물건을 사 www.acmicpc.net 정답 소스코드 (Python) cost=int(input()) cost=1000-cost result=0 def calculate(value): global cost,result if cost>=value: result+=cost//value cost-=value*(cost//value) for ele in [500,100,50,10,5,1]:calculate(ele) print(result) 풀이 (Python) 그리디 문제의 제일 ..