#include void QuickSort(int *, int, int); int main(void) { int n, i, input_num[1000], idx; float median; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%d", &input_num[i]); } QuickSort(input_num, 0, n - 1); idx = (n - 1) / 2; median = (float)input_num[idx++]; if(n % 2 == 0 && n > 1){ while(1){ if((int)median != input_num[idx]){ median += (float)input_num[idx]; median = median / 2; break; } } } printf("%0.1f\n", median); return 0; } void QuickSort(int *a, int first, int last) { int i, j, x, t; x = a[(first + last) / 2]; i = first; j = last; for( ; ; ){ while(a[i] < x) i++; while(x < a[j]) j--; if(i >= j) break; t = a[i]; a[i] = a[j]; a[j] = t; i++; j--; } if(first < i - 1) QuickSort(a, first, i - 1); if(j + 1 < last) QuickSort(a, j + 1,last); }