Skip to content

Commit e892a7d

Browse files
committed
Add 24420.cpp
1 parent 1e40b43 commit e892a7d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: 24xxx/24420.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <algorithm>
2+
#include <iostream>
3+
#include <numeric>
4+
#include <vector>
5+
using namespace std;
6+
7+
void solve(void) {
8+
int n; cin >> n;
9+
vector<int> a(n);
10+
for (int i=0; i<n; i++) cin >> a[i];
11+
12+
cout << accumulate(a.begin(), a.end(), 0) - *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
13+
}
14+
15+
int main(void) {
16+
ios::sync_with_stdio(false);
17+
cin.tie(nullptr);
18+
19+
solve();
20+
return 0;
21+
}

0 commit comments

Comments
 (0)