반응형
[ Contents ]
1. 문제 (링크 참조)
17009번: Winning Score
The first three lines of input describe the scoring of the Apples, and the next three lines of input describe the scoring of the Bananas. For each team, the first line contains the number of successful 3-point shots, the second line contains the number of
www.acmicpc.net
2. 문제 풀이
농구 점수를 계산하고, 승패를 판별하는 문제입니다.
3. 코드
apple = 0
banana = 0
# 입력
for i in range(3, 0, -1):
apple += int(input())*i
for i in range(3, 0, -1):
banana += int(input())*i
# 비교 후 출력
if apple > banana:
print('A')
elif apple < banana:
print('B')
else:
print('T')
점수를 계산해서, 더 많이 획득한 팀을 출력합니다. 만약 점수가 같다면 'T'를 출력합니다.
반응형
'Algorithm' 카테고리의 다른 글
[탐색/BFS] 백준 12851 숨바꼭질 2 - 파이썬(Python) (1) | 2022.08.09 |
---|---|
[구현/수학] 백준 13136 Do Not Touch Anything - 파이썬(Python) (0) | 2022.08.08 |
[Greedy/그리디] 백준 13597 Tri-du - 파이썬(Python) (0) | 2022.08.06 |
[구현/수학] 백준 18005 Even or Odd? - 파이썬(Python) (0) | 2022.08.05 |
[구현/수학] 백준 19698 헛간 청약 - 파이썬(Python) (0) | 2022.08.04 |
댓글