[백준] 11399 ATM

0

백준

목록 보기
176/271
post-thumbnail
post-custom-banner

[백준] 11399 ATM

#include<algorithm>
#include <vector>
#include <iostream>
using namespace std;

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int n;
	cin >> n;
	vector<ll> time;
	for (int i = 0; i < n; ++i) {
		ll input;
		cin >> input;
		time.push_back(input);
	}
	sort(time.begin(), time.end());

	ll sum = 0;
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		sum += time[i];
		ans += sum;
	}

	cout << ans;
	return 0;
}
profile
Be able to be vulnerable, in search of truth
post-custom-banner

0개의 댓글