링크 : https://school.programmers.co.kr/learn/courses/30/lessons/148653
회고 : 재귀로 푼 사람 많지만, while문으로도 충분히 가능. 추가로 solution(555) = 14 나오는지 확인해보면 좋을 것.
python
def solution(storey):
count = 0
while True:
storey, rest = storey // 10, storey % 10
if rest > 5 or (rest == 5 and storey % 10 >= 5):
count += 10 - rest
storey += 1
else:
count += rest
if storey == 0:
break
return count