2839번

김범주·2022년 7월 18일
0

백준 파이썬

목록 보기
18/29
post-thumbnail
N = int(input())
ans = 0

while True:
  if (N % 5) == 0:
    ans += (N // 5)
    print(ans)
    break
  N -= 3
  ans += 1
  if N < 0:
    print('-1')
    break

while 문 안에서 5의 배수일 때와 아닐때로 분기
아닌경우 3씩 빼면서 반복하다가 0보다 작아지면 안되는 경우이므로 -1 출력

profile
개발꿈나무

0개의 댓글