Today
Total
07-05 02:35
관리 메뉴

T-coding

백준 2303 숫자 게임 / Python 본문

Baekjoon

백준 2303 숫자 게임 / Python

Tcoding 2023. 3. 26. 23:39
728x90
728x90

https://www.acmicpc.net/problem/2303

 

2303번: 숫자 게임

N명이 모여 숫자 게임을 하고자 한다. 각 사람에게는 1부터 10사이의 수가 적혀진 다섯 장의 카드가 주어진다. 그 중 세 장의 카드를 골라 합을 구한 후 일의 자리 수가 가장 큰 사람이 게임을 이

www.acmicpc.net

 

 

 

코드

더보기
from itertools import combinations
n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
ans = 0
ans_max = 0
for i in range(n):
    combi = list(combinations(arr[i], 3))
    temp = 0
    for j in combi:
        temp = max(temp, sum(j) % 10)
    if temp >= ans_max:
        ans = i + 1
        ans_max = temp
print(ans)

 

728x90
300x250