#K44927. Median of Grades
Median of Grades
Median of Grades
You are given a list of integer grades. Your task is to compute the median of these grades.
The median is defined as follows: if the number of grades, \( n \), is odd then the median is the middle element when the list is sorted. If \( n \) is even, then the median is the average of the two middle elements, i.e., \( \text{median} = \frac{a_{\frac{n}{2}} + a_{\frac{n}{2}+1}}{2} \) (note that the indices here assume 1-indexing after sorting).
The input will be read from standard input and the median should be printed to standard output as a float number.
inputFormat
The input is given via stdin:
- The first line contains a single integer \( n \) (the number of grades).
- The second line contains \( n \) space-separated integers representing the grades.
outputFormat
Output a single floating point number which is the median of the grades. If the number of grades is even, output the average of the two middle numbers.
## sample1
85
85.0