관리 메뉴

솜씨좋은장씨

[BaekJoon] 17009번 : Winning Score (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 17009번 : Winning Score (Python)

솜씨좋은장씨 2022. 7. 11. 20:02
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Winning Score 입니다.

 

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

👨🏻‍💻 코드 ( Solution )

def calculate_basketball_score(score_list, basketball_score_rule):
    score_list = [(score * baseket_ball_score) for score, baseket_ball_score in zip(score_list, basketball_score_rule)]
    
    return sum(score_list)


def winning_score(banana_score, apple_score):
    basketball_score_rule = [3, 2, 1]
    banana_basketball_score = calculate_basketball_score(score_list=banana_score, 
                                                         basketball_score_rule=basketball_score_rule)
    apple_basketball_score = calculate_basketball_score(score_list=apple_score, 
                                                        basketball_score_rule=basketball_score_rule)
    
    
    if banana_basketball_score < apple_basketball_score:
        answer = "A"
    elif banana_basketball_score > apple_basketball_score:
        answer = "B"
    else:
        answer = "T"
        
    return answer 


if __name__ == "__main__":
    apple_score, banana_score = [], []
    
    for idx in range(6):
        score = int(input())
        if idx < 3:
            apple_score.append(score)
        else:
            banana_score.append(score)
            
    print(winning_score(banana_score, apple_score))
 

GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07

1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.

github.com

Comments