We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea4d49c commit 18a88bdCopy full SHA for 18a88bd
minjeong/Greedy/2024-12-20-[백준]-#2217-로프.py
@@ -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