Skip to content

Commit 4ecfbf8

Browse files
committed
Add 27335.cpp
1 parent fabb0b8 commit 4ecfbf8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

27xxx/27335.cpp

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

0 commit comments

Comments
 (0)