모든 로프를 사용해야 할 필요가 없다는 부분만 인지하면 크게 어려울 것은 없을 듯 하다.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class BaekJoon2217 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine()); //입력받을 로프 갯수
int[] ropes = new int[n]; //각 로프가 버틸 수 있는 중량
int res = 0; //결과값
for(int i = 0; i < n; i++) {
ropes[i] = Integer.parseInt(br.readLine());
}
Arrays.sort(ropes); //오름차순으로 정렬
res = ropes[0] * n; //기본값 세팅
for(int i = 1; i < n; i++) { //버틸 수 있는 중량은 가장 낮은 로프의 중량 * 로프 수이므로
if(ropes[i] * (n - i) > res) { //작은 순서대로 로프를 하나씩 제해가며 모든 로프를 제할 때 까지 계산하여
res = ropes[i] * (n - i); //만약 로프를 제외하고 계산한 값이 더 클 경우, 결과값으로 변경
}
}
System.out.print(res);
}
}