-
백준 11399 C++ 풀이카테고리 없음 2018. 10. 31. 08:40반응형
#include <iostream>
#include <algorithm>
using namespace std;
int p[1001];
int main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
int n, k;
int answer =0;
cin >> n;
for (auto i=0; i<n; i++){
cin >> p[i];
}
sort(p, p+n);
for (auto i=0; i<n;i++){
answer += p[i]*(n-i);
}
cout << answer;
}반응형