728x90
* 문제
https://www.acmicpc.net/problem/5585
[ 코드 ]
money=int(input())
bill = 1000
change = bill-money
n_500 = change//500
change%=500
n_100 = change//100
change%=100
n_50 = change//50
change%=50
n_10 = change//10
change%=10
n_5 = change//5
change%=5
n_1 = change
print(n_500+n_100+n_50+n_10+n_5+n_1)
반응형
'알고리즘' 카테고리의 다른 글
graham scan으로 convex hull 그리기 (0) | 2021.06.16 |
---|---|
0/1 knapsack에서 bound 구하기 (0) | 2021.06.16 |
[ Python ] 코드업 1229 (0) | 2021.06.14 |
[ C ] tromino (0) | 2021.04.02 |
[ C ] 분할정복 - 하노이탑 (a divide-and-conquer algorithm for the Towers of Hanoi problem) (0) | 2021.04.01 |