반응형
[ Contents ]
1. 문제 (링크 참조)
24568번: Cupcake Party
A regular box of cupcakes holds 8 cupcakes, while a small box holds 3 cupcakes. There are 28 students in a class and a total of at least 28 cupcakes. Your job is to determine how many cupcakes will be left over if each student gets one cupcake.
www.acmicpc.net
2. 문제 풀이
작은 상자에는 3개씩, 큰 상자에는 8개씩 컵 케이크가 들어있습니다. 작은 상자와 큰 상자의 개수가 주어질 때, 28개를 제외하고 남는 컵 케이크 수를 구해야 합니다.
3. 코드
# 입력
R = int(input())
S = int(input())
# 출력
res = R*8 + S*3 - 28
print(res if res >= 0 else 0)
28개보다 많으면 남고, 적으면 남지 않습니다. (0개)
반응형
'Algorithm' 카테고리의 다른 글
[Greedy/그리디] 백준 1946 신입 사원 - 파이썬(Python) (0) | 2022.07.20 |
---|---|
[구현/수학] 백준 24183 Affischutskicket - 파이썬(Python) (0) | 2022.07.19 |
[동적계획법/DP] 백준 11048 이동하기 - 파이썬(Python) (0) | 2022.07.17 |
[구현/수학] 백준 24309 РАВЕНСТВО(평등) - 파이썬(Python) (0) | 2022.07.16 |
[구현/수학] 백준 8871 Zadanie próbne 2 - 파이썬(Python) (0) | 2022.07.15 |
댓글