반응형
[ Contents ]
1. 문제 (링크 참조)
19602번: Dog Treats
There are three lines of input. Each line contains a non-negative integer less than 10. The first line contains the number of small treats, S, the second line contains the number of medium treats, M, and the third line contains the number of large treats,
www.acmicpc.net
2. 문제 풀이
1*S + 2*M + 3*L
S, M, L 사이즈를 가진 간식의 개수가 주어집니다. 간식의 양이 10 이상이어야 happy이고, 미만이면 sad를 출력합니다.
3. 코드
# 입력
s = int(input())
m = int(input())
l = int(input())
# 계산
score = s + 2*m + 3*l
# 출력
if score >= 10:
print("happy")
else:
print("sad")
반응형
'Algorithm' 카테고리의 다른 글
[구현/수학] 백준 15059 Hard choice - 파이썬(Python) (0) | 2022.08.19 |
---|---|
[정렬/브루트포스] 백준 1015 수열 정렬 - 파이썬(Python) (0) | 2022.08.18 |
[구현/수학] 백준 18408 3 つの整数 (Three Integers) - 파이썬(Python) (0) | 2022.08.16 |
[구현/브루트포스] 백준 1051 숫자 정사각형 - 파이썬(Python) (0) | 2022.08.15 |
[구현/문자열] 백준 6810 ISBN - 파이썬(Python) (0) | 2022.08.14 |
댓글