BOJ - 1448 - 삼각형 만들기

Updated:

import sys

def solution():
    
    T = int(input())
    data = []

    for i in range(T):
        data.append(int(sys.stdin.readline()))

    data.sort(reverse=True)

    flag = False

    for i in range(len(data) - 2):
        if data[i] < data[i + 1] + data[i + 2]:
            print(data[i] + data[i + 1] + data[i + 2])
            flag = True
            break
        
    if not flag:
        print(-1)

solution()

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

Categories:

Updated:

Leave a comment