# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851235 | dosts | Autići (COCI22_autici) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define sp << " " <<
#define int long long
#define vi vector<int>
#define pb push_back
const int N = 1e5+1;
void solve() {
int n;
cin >> n;
vi a(n+1);
for (int i=1;i<=n;i++) cin >> a[i];
int sm =0;
for (int i=1;i<=n;i++) sm+=a[i];
int mn = *min_element(a.begin()+1,a.end());
cout << (n-1)*mn+sm-mn << endl;5
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t = 1;
//cin >> t;
while (t --> 0) solve();
}