#C11811. Median Calculator

    ID: 41169 Type: Default 1000ms 256MiB

Median Calculator

Median Calculator

You are given several test cases. In each test case, you are provided a list of integers. Your task is to compute the median of the list.

The median is defined as follows:

If the number of elements, \( n \), is odd, then the median is the middle element after sorting the list. If \( n \) is even, then the median is given by \( \frac{a_{\frac{n}{2}}+a_{\frac{n}{2}+1}}{2} \) where \( a_i \) denotes the \( i \)th smallest element. The result must be printed with exactly one digit after the decimal point.

inputFormat

The input begins with a single integer \( T \) representing the number of test cases. Each test case consists of two lines. The first line contains an integer \( N \) which is the number of elements in the list. The second line contains \( N \) space separated integers.

outputFormat

For each test case, output the median value on a new line. The median must be printed with exactly one digit after the decimal point.

## sample
3
5
1 3 5 7 9
4
1 2 3 4
3
-5 -3 -1
5.0

2.5 -3.0

</p>