"""
출처: 프로그래머스 코딩 테스트 연습,
https://school.programmers.co.kr/learn/courses/30/lessons/120837
"""
# 풀이 과정
def solution(hp):
count=0
while True:
for a in [5,3,1]:
if hp>=a:
count+=int(hp/a)
hp=hp%a
if hp==0:
return count
if hp==0:
return 0
Lv0 프로그래머스(Programmers)[Python][파이썬] 개미 군단
"""
출처: 프로그래머스 코딩 테스트 연습,
https://school.programmers.co.kr/learn/courses/30/lessons/120837
"""
# 풀이 과정
def solution(hp):
count=0
while True:
for a in [5,3,1]:
if hp>=a:
count+=int(hp/a)
hp=hp%a
if hp==0:
return count
if hp==0:
return 0