Submission #851236

#TimeUsernameProblemLanguageResultExecution timeMemory
851236dostsAutići (COCI22_autici)C++14
50 / 50
10 ms2140 KiB
#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; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t = 1; //cin >> t; while (t --> 0) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...