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 ll long long
#define ii pair<ll,ll>
#define endl '\n'
const ll inf=1e15;
const ll mod=1e9+7;
const ll maxn=1e5+5;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n;
cin>>n;
if (n==1){
cout<<0;
return 0;
}
ll sum=0,ele,mini=inf;
for (int i=0;i<n;i++){
cin>>ele;
sum+=ele;
mini=min(ele,mini);
}
cout<<sum+mini*(n-2);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |