#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int n;
cin >> n;
vector<int> g(n);
for(int i= 0;i<n;i++) cin >> g[i];
sort(g.begin(),g.end());
int ans = (n-1)*g[0];
for(int i = 1;i<n;i++) ans += g[i];
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
6 ms |
596 KB |
Output is correct |
3 |
Incorrect |
14 ms |
1720 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
6 ms |
596 KB |
Output is correct |
3 |
Incorrect |
14 ms |
1720 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |