Skip to content

Instantly share code, notes, and snippets.

@Acarus
Created March 4, 2017 15:13
Show Gist options
  • Save Acarus/c161ca5c69a5e1e0c14145baf58c325d to your computer and use it in GitHub Desktop.
Save Acarus/c161ca5c69a5e1e0c14145baf58c325d to your computer and use it in GitHub Desktop.
A
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, char **argv) {
// ios::sync_with_stdio(false);
srand(time(0));
#ifndef ONLINE_JUDGE
freopen("/home/acarus/input.txt", "r", stdin);
#endif
int n, x;
scanf("%d", &n);
int xMin = INT_MAX, xMax = INT_MIN;
for (int i = 0; i < n; ++i) {
scanf("%d", &x);
xMin = min(xMin, x);
xMax = max(xMax, x);
}
printf("%d\n", xMin + (xMax - xMin) / 2);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment