Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define N 100000
- int compare_int(const void *p1, const void *p2) {
- return *(int *) p1 - *(int *) p2;
- }
- int main(void) {
- int n = 0, v[N];
- while (~scanf("%d", &v[n++]))
- ;
- n--;
- qsort(v, n, sizeof(int), compare_int);
- if (abs(v[0] - v[n / 2]) > abs(v[n - 1] - v[n / 2])) printf("%d\n", v[0]);
- else printf("%d\n", v[n - 1]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement