[伯俊]217ロープ(銀4)
白駿(シルバー4)-2217.ロープ(銀4)
に答える
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Integer[] rope = new Integer[n];
for(int i=0; i<n; i++) {
rope[i] = sc.nextInt();
}
Arrays.sort(rope,Collections.reverseOrder());
int max = rope[0];
for(int i=1; i<n; i++) {
rope[i] *= (i+1);
if(max <rope[i]) max = rope[i];
}
System.out.println(max);
}
}
Reference
この問題について([伯俊]217ロープ(銀4)), 我々は、より多くの情報をここで見つけました https://velog.io/@humblechoi/백준-2217.-로프실버4テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol