#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
int ans = 0;
sort(v.begin(), v.end());
for (int i = 0; i < n; i++)
ans += v[i] * (n - i);
cout << ans;
return 0;
}
'코딩테스트 > 백준' 카테고리의 다른 글
[실4] 2578 - 빙고 (0) | 2025.02.24 |
---|---|
[실4] 9372 - 상근이의 여행 (0) | 2025.01.31 |
[실3] 16967 - 배열 복원하기 (0) | 2025.01.19 |
[실4] 2217 - 로프 (0) | 2025.01.12 |
[실5] 10814 - 나이순 정렬 (0) | 2025.01.04 |