로프들에 대한 정보가 주어졌을 때, 들어올릴 수 있는 물질의 최대 무게 구하기
(병렬 연결로 물체 무게 나눌 수 있음)
#include <bits/stdc++.h>
using namespace std;
int n;
int w[100005];
int ans = 0;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; i++) cin >> w[i];
sort(w, w + n);
for(int i = 1; i <= n; i++){
ans = max(w[n-i] * i, ans);
}
cout << ans;
}
**바킹독님 자료 참고: https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x11/solutions/2217.cpp