1.22号英语翻译
题目来源:http://noi.openjudge.cn/ch0401/1625/
重点词汇:
semi-sum :n.半和;
subsequent: adj. 后续的;
value:n.数值;
1625:Sequence Median
序列中位数
- 查看
- 提交
- 统计
- 提问
- 总时间限制:
- 1000ms
- 内存限制:
- 65536kB
- 描述
- Given a sequence of N nonnegative integers. Let's define the median of such sequence. If N is odd the median is the element with stands in the middle of the sequence after it is sorted. One may notice that in this case the median has position (N+1)/2 in sorted sequence if sequence elements are numbered starting with 1. If N is even then the median is the semi-sum of the two "middle" elements of sorted sequence. I.e. semi-sum of the elements in positions N/2 and (N/2)+1 of sorted sequence. But original sequence might be unsorted.
给定一个由 N 个非负整数组成的序列。让我们定义这样的序列的中位数。如果 N 是奇数,则中位数是排序后位于序列中间的元素。人们可能会注意到,在这种情况下,如果序列元素从 1 开始编号,则中位数在排序序列中的位置为 (N+1)/2。如果 N 是偶数,则中位数是两个“中间”元素的半和排序的序列。i. e.排序序列的位置 N/2 和 (N/2)+1 中的元素的半和。但原始序列可能未排序。
Your task is to write program to find the median of given sequence.- 你的任务是编写程序来找到给定序列的中位数。
- 输入
- The first line of input contains the only integer number N - the length of the sequence. Sequence itself follows in subsequent lines, one number in a line. The length of the sequence lies in the range from 1 to 250000. Each element of the sequence is a positive integer not greater than 2^32 - 1 inclusive.
- 输入的第一行包含唯一的整数 N - 序列的长度。序列本身跟随在后续行中,一行中的一个数字。序列的长度在 1 到 250000 的范围内。序列的每个元素都是不大于 2^32 - 1 的正整数。
- 输出
- You should print the value of the median with exactly one digit after decimal point.
- 你应该打印小数点后恰好一位数的中位数值。
- 样例输入
-
4 3 6 4 5
- 样例输出
-
4.5