1813: 【CSP数组】求中位数█

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:18 Solved:8

Description

中位数指的是一组数,如果按照大小排序排好后最中间的那个数的值,如果有偶数个元素,那么就是最中间两个数的平均数!

比如:lns="http://www.w3.org/1998/Math/MathML">2 lns="http://www.w3.org/1998/Math/MathML">5 lns="http://www.w3.org/1998/Math/MathML">8 lns="http://www.w3.org/1998/Math/MathML">1 lns="http://www.w3.org/1998/Math/MathML">6 ,排序后的结果为 lns="http://www.w3.org/1998/Math/MathML">1 lns="http://www.w3.org/1998/Math/MathML">2 lns="http://www.w3.org/1998/Math/MathML">5 lns="http://www.w3.org/1998/Math/MathML">6 lns="http://www.w3.org/1998/Math/MathML">8 ,那么这组数的中位数就是 lns="http://www.w3.org/1998/Math/MathML">5 !

再比如: lns="http://www.w3.org/1998/Math/MathML">8 lns="http://www.w3.org/1998/Math/MathML">9 lns="http://www.w3.org/1998/Math/MathML">1 lns="http://www.w3.org/1998/Math/MathML">2 lns="http://www.w3.org/1998/Math/MathML">3 lns="http://www.w3.org/1998/Math/MathML">0 ,排序后的结果为 lns="http://www.w3.org/1998/Math/MathML">0 lns="http://www.w3.org/1998/Math/MathML">1 lns="http://www.w3.org/1998/Math/MathML">2 lns="http://www.w3.org/1998/Math/MathML">3 lns="http://www.w3.org/1998/Math/MathML">8 lns="http://www.w3.org/1998/Math/MathML">9 ,那么这组数的中位数就是 lns="http://www.w3.org/1998/Math/MathML">(2+3)/2=2.5 。

Input

第一行:一个整数 lns="http://www.w3.org/1998/Math/MathML">n 代表有 lns="http://www.w3.org/1998/Math/MathML">n 个数( lns="http://www.w3.org/1998/Math/MathML">n100) 。

第二行: lns="http://www.w3.org/1998/Math/MathML">n 个数的值。

Output

中位数(结果保留1位小数)。

Sample Input Copy

5
2 5 8 1 6

Sample Output Copy

5.0