[백준 2303][Python] 숫자 게임

봉글렛·2022년 12월 27일

백준

목록 보기
6/55

문제 링크 https://www.acmicpc.net/problem/2303

번호가 가장큰거였는데... 카드를 더한값이 큰걸 생각해서 고생함.... ㅜㅜ

풀이

n = int(input())
best_s = []
for i in range(n):
    cards = [*map(int, input().split())]
    max_n = 0
    for one in range(5):
        for two in range(one+1, 5):
            for three in range(two+1, 5):
                temp = (cards[one]+cards[two]+cards[three]) % 10
                if max_n < temp:
                    max_n = temp
    best_s.append(max_n)
best = max(best_s)
for i in range(n-1, -1, -1):
    if best == best_s[i]:
        print(i+1)
        break
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글