백준 2217번: 로프 #Python

ColorlessDia·2024년 5월 12일

algorithm/baekjoon

목록 보기
174/807
import sys

N = int(sys.stdin.readline())
rope_list = [int(sys.stdin.readline()) for _ in range(N)]

max_weight = 0
k = 1

for rope in sorted(rope_list, reverse=True):
    weight = rope * k

    if max_weight < weight:
        max_weight = weight

    k += 1

print(max_weight)

0개의 댓글