Skip to content

Commit 18a88bd

Browse files
committed
[BOJ] #2217. 로프 / 실버4 / 25분 / 힌트,성공
1 parent ea4d49c commit 18a88bd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
# 입력 받기
5+
N = int(input()) # 로프 개수
6+
rope = [int(input()) for _ in range(N)]
7+
8+
# 내림차순 정렬
9+
rope.sort(reverse=True)
10+
11+
# 최대 중량 계산
12+
max_weight = 0
13+
for i in range(N):
14+
# i + 1: 현재 사용된 로프 개수
15+
max_weight = max(max_weight, rope[i] * (i + 1))
16+
17+
print(max_weight)

0 commit comments

Comments
 (0)