본문 바로가기
공부/코딩테스트

백준: 14489번 치킨 두 마리 (Python3)

by 혼밥맨 2022. 8. 10.
반응형

백준: 14489번 치킨 두 마리 (Python3)

Winning Score 성공다국어

 
시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB 2001 1604 1510 81.226%

문제

You record all of the scoring activity at a basketball game. Points are scored by a 3-point shot, a 2-point field goal, or a 1-point free throw.

You know the number of each of these types of scoring for the two teams: the Apples and the Bananas. Your job is to determine which team won, or if the game ended in a tie.

입력

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 successful 2-point field goals, and the third line contains the number of successful 1-point free throws. Each number will be an integer between 0 and 100, inclusive.

출력

The output will be a single character. If the Apples scored more points than the Bananas, output 'A'. If the Bananas scored more points than the Apples, output 'B'. Otherwise, output 'T', to indicate a tie.

예제 입력 1

10
3
7
8
9
6

예제 출력 1

B

The Apples scored 10⋅3+3⋅2+7⋅1 = 43 points and the Bananas scored 8⋅3+9⋅2+6⋅1 = 48 points, and thus the Bananas won.

예제 입력 2 

7
3
0
6
4
1

예제 출력 2 

T

The Apples scored 7⋅3+3⋅2+0⋅1 = 27 points and the Bananas scored 6⋅3+4⋅2+1⋅1 = 27 points, and thus it was a tie game.

답안

1
2
3
4
5
6
7
8
9
10
11
apple_three = int(input())
apple_two = int(input())
apple_one = int(input())
banana_three = int(input())
banana_two = int(input())
banana_one = int(input())
 
apple_sum = apple_three*3+apple_two*2+apple_one
banana_sum = banana_three*3+banana_two*2+banana_one
 
print("A" if apple_sum > banana_sum else ("B" if banana_sum>apple_sum else "T") )
cs

반응형

댓글