Description
將一個數列由小排到大而資料數為奇數時,居中的資料稱為該數列之中位數,若該資料數為偶數時,則最中間兩數值相加之平均稱為中位數,
例如數列 1 2 3 4 51 2 3 4 5,則中位數為 33,而數列 1 2 3 5 6 71 2 3 5 6 7 之中位數為 (3+5)/2=4(3+5)/2=4。
請撰寫一個程式,讓使用者輸入一個數列並且找出其中位數。
When a sequence is arranged from small to large and the number of data is an odd number, the data in the center is called the median of the sequence. If the number of data is an even number, the average of the two middle values is called the median. number of digits,
For example, in the sequence 1 2 3 4 51 2 3 4 5 , the median is 33 , and in the sequence 1 2 3 5 6 71 2 3 5 6 7, the median is (3+5)/2=4(3+5)/2=4.
Please write a program that allows the user to input a sequence of numbers and find its median.
Input
輸入包含以下兩行:
第一行為一個整數 n(5≤n≤15), 代表接下來將有 n 個輸入整數。
�(5≤�≤15)
�
第二行將有 n 個整數為使用者的輸入。
�
The input contains the following two lines:
The first line is an integer n(5≤n≤15), which means there will be n input integers next.
�(5≤�≤15)
�
The second line will have n integers as user input.
�
Output
請輸出數列中的中位數。
Please output the median in the series.
Sample Input 1
13
60 98 92 5 97 1 39 24 67 15 33 22 76
Sample Output 1