Time Lapse :None 11399.cpp1234567891011121314151617181920212223242526272829303132#include <iostream>#include <math.h>#include <string>#include <algorithm>#include <cstring>#include <vector>#include <cstdio>using namespace std;#define MAXSIZE 1000vector<int> arr;int ans=0;int N;int num;int main(void){ cin >> N; for (int i = 0; i < N; i++) { cin >> num; arr.push_back(num); } sort(arr.begin(), arr.end()); for (int i = 0; i < N; i++) { ans += arr[i] * (N - i); } cout << ans << endl;}