#C10636. Find Median Score
Find Median Score
Find Median Score
You are given the number of students N and a list of N integer scores. Your task is to compute the median score.
Sort the list of scores in non-decreasing order. The median is defined as follows:
- If N is odd, the median is the middle element, i.e. the element at index (N+1)/2 of the sorted list.
- If N is even, the median is the average of the two middle elements. In mathematical form, if the sorted scores are \(a_1, a_2, \ldots, a_N\), then the median is given by \(\frac{a_{N/2} + a_{N/2+1}}{2}\).
Output the median as a floating point number (with a decimal point).
inputFormat
The input is read from stdin and has the following format:
N score_1 score_2 ... score_N
Where:
N
is an integer representing the number of students.score_i
(for 1 ≤ i ≤ N) are the integer scores.
outputFormat
Output a single line to stdout containing the median score as a floating point number.
## sample5
55 70 85 90 82
82.0
</p>