#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5;
#define ll long long
ll n, mn=LLONG_MAX, d[nx], res;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++) cin>>d[i], mn=min(mn, d[i]);
res-=2*mn;
for (int i=1; i<=n; i++) res+=d[i]+mn;
cout<<res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
1372 KB |
Output is correct |
3 |
Correct |
8 ms |
2136 KB |
Output is correct |
4 |
Correct |
7 ms |
1964 KB |
Output is correct |
5 |
Correct |
8 ms |
2164 KB |
Output is correct |
6 |
Correct |
9 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
472 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
1372 KB |
Output is correct |
3 |
Correct |
8 ms |
2136 KB |
Output is correct |
4 |
Correct |
7 ms |
1964 KB |
Output is correct |
5 |
Correct |
8 ms |
2164 KB |
Output is correct |
6 |
Correct |
9 ms |
1884 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
472 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
4 ms |
1372 KB |
Output is correct |
22 |
Correct |
7 ms |
2136 KB |
Output is correct |
23 |
Correct |
7 ms |
2140 KB |
Output is correct |
24 |
Correct |
7 ms |
1884 KB |
Output is correct |
25 |
Correct |
7 ms |
2140 KB |
Output is correct |
26 |
Correct |
7 ms |
1940 KB |
Output is correct |
27 |
Correct |
11 ms |
2128 KB |
Output is correct |
28 |
Correct |
7 ms |
1884 KB |
Output is correct |
29 |
Correct |
8 ms |
2140 KB |
Output is correct |
30 |
Correct |
7 ms |
2140 KB |
Output is correct |