본문 바로가기
Algorithm

[구현/수학] 백준 17009 Winning Score - 파이썬(Python)

by jangThang 2022. 8. 7.
반응형

백준 온라인 저지

 

[ 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'를 출력합니다.

     

    star가 되고나서 Tistory

    반응형

    댓글