#K7211. Median Score Calculation

    ID: 33681 Type: Default 1000ms 256MiB

Median Score Calculation

Median Score Calculation

Given a list of scores, your task is to compute the median score. First, sort the list in non-decreasing order. If the number of scores, (n), is odd then the median is defined as the element at position (\frac{n+1}{2}). If (n) is even, the median is defined as

[ \text{median} = \frac{a_{\frac{n}{2}} + a_{\frac{n}{2}+1}}{2} ]

where (a_i) is the (i)th smallest score. Note that when (n) is even, the output must be printed as a floating-point number with exactly one digit after the decimal point (even if the fractional part is zero). The input and output will be given via standard input and standard output respectively.

inputFormat

The first line contains an integer (n) ((1 \le n \le 10^5)) representing the number of scores. The second line contains (n) space-separated integers representing the scores.

outputFormat

Print the median score. If (n) is even, print the result as a floating-point number with one digit after the decimal point.## sample

5
3 1 4 1 5
3

</p>