Skip to content

Commit 983ad92

Browse files
committed
#34 : 2839_설탕 배달
1 parent 96bb239 commit 983ad92

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

이티준희/2839_설탕 배달.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 2839_설탕 배달
2+
# -> 정답
3+
4+
N = int(input())
5+
count = 0
6+
7+
while N >= 0:
8+
if N % 5 == 0 : # 전체 무게의 합을 5로 나누었을 때 나누어 떨어지면
9+
count += N // 5 # 그 몫 만큼 봉지 추가
10+
print (count) # 총 봉지 수 출력
11+
break
12+
N -= 3 # 전체 무게의 합에서 3 빼기
13+
count += 1 # 3kg 봉지 한 개 추가
14+
15+
if N < 0 : # 봉지를 만들 수 없는 음수
16+
print(-1) # -1 출력

0 commit comments

Comments
 (0)