문제
풀이
- zip 내장함수로 football points와 input data를 1대1 매칭으로 합산해 점수를 구하였다
코드
import sys
input = sys.stdin.readline
def solve(scores1: list, scores2: list):
football_points = [6, 3, 2, 1, 2]
score1_result = sum([x*y for x, y in zip(football_points, scores1)])
score2_result = sum([x*y for x, y in zip(football_points, scores2)])
return score1_result, score2_result
if __name__ == '__main__':
scores1 = list(map(int, input().split()))
scores2 = list(map(int, input().split()))
print(*solve(scores1, scores2))
결과
출처 & 깃허브
boj 24736