[백준] 2839번 설탕배달 풀이

SongKS·2020년 7월 2일
0

백준 알고리즘

목록 보기
2/7

https://www.acmicpc.net/problem/2839

a = int(input())
b = 3
c = 5
result = 0

while (a != 0):
    if a % c == 0:
        a -= c
        result += 1
    elif a % b == 0:
        a -= b
        result += 1
    elif a > c:
        a -= c
        result += 1
    else:
        result = -1
        break

print(result)
profile
백엔드와 프론트, DevOps 사이에 표류하는 개발자

0개의 댓글