anon20016

E

Nov 14th, 2019
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define _CRT_SECURE_NO_DEPRECATE
  2.  
  3. #include <iostream>
  4. #include <vector>
  5. #include <string>
  6. #include <map>
  7. #include <stack>
  8. #include <algorithm>
  9.  
  10. using namespace std;
  11.  
  12. int a[5001];
  13.  
  14. int main() {
  15.  
  16. int n;
  17. cin >> n;
  18. for (int i = 0; i < n; i++) {
  19. cin >> a[i];
  20. }
  21. sort(a, a + n);
  22. if (n % 2 == 0) {
  23. cout << (double)(a[n / 2] + a[n / 2] - 1) / 2;
  24. }
  25. else {
  26. cout << a[n / 2];
  27. }
  28. }
RAW Paste Data