[백준] P11399

동민·2021년 3월 11일
0
import java.util.Arrays;
import java.util.Scanner;

public class P11399 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int answer = 0, n = sc.nextInt(), a[] = new int[n], acc = 0;

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		for (int ele : a) {
			acc += ele;
			answer += acc;
		}
		System.out.println(answer);
		sc.close();

	}
}
profile
BE Developer

0개의 댓글