[문제]
https://www.acmicpc.net/problem/2217
2217번: 로프
N(1 ≤ N ≤ 100,000)개의 로프가 있다. 이 로프를 이용하여 이런 저런 물체를 들어올릴 수 있다. 각각의 로프는 그 굵기나 길이가 다르기 때문에 들 수 있는 물체의 중량이 서로 다를 수도 있다. 하
www.acmicpc.net
[생각거리]
-
[코드]
n= int(input())
weights = []
for i in range(n):
weight = int(input())
weights.append(weight)
weights.sort()
max = 0
for i in range(n):
weight_p = weights[i]*(n-i)
if weight_p > max:
max = weight_p
print(max)
'알고리즘' 카테고리의 다른 글
[softeer] GBC (0) | 2022.06.27 |
---|---|
[softeer] 회의실 예약 (0) | 2022.06.27 |
[softeer] 플레이페어 암호 (0) | 2022.06.27 |
[그리디 알고리즘] 백준 11399번 ATM (0) | 2022.06.25 |
[그리디 알고리즘] 백준 1931번 회의실 배정 (0) | 2022.06.25 |
댓글