#include <bits/stdc++.h>
#define _files
#define _multitest
#define _Debug
using namespace std;
void just_do_it();
int main() {
#define task ""
#ifdef _files_
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
#endif
#ifdef _Debug
ios_base::sync_with_stdio(0);
#endif
cin.tie(0);
just_do_it();
return 0;
}
#define __builtin_popcount __builtin_popcountll
#define BIT(x, i) (((x)>> (i))& (1LL))
#define MASK(x) (1LL<< (x))
#define MOD 1000000007
#define ll long long
const int maxm= (int)1e6, maxn= (int)1e5, maxb= (int)1e3;
ll INF= (ll)1e18;
void minimize(int &x, const int &y){
if(x> y) x= y;
}
int n, d[maxn+ 2], mn;
ll ans;
void input(){
cin>> n;
for(int i= 1; i<= n; i++){
cin>> d[i];
}
}
void prepare(){
}
void solve(){
mn= MOD;
for(int i= 1; i<= n; i++){
minimize(mn, d[i]);
}
ans= 0;
for(int i= 1; i<= n; i++){
ans+= d[i]+ mn;
}
}
void printans(){
cout<< ans- mn- mn;
}
void reset(){
}
void test(){
input();
prepare();
solve();
printans();
reset();
}
void just_do_it() {
int nTest= 1;
#ifdef _multitest_
cin>>nTest;
#endif
for (int it= 1; it <= nTest; it++) {
test();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |