1625:Sequence Median(翻译)

http://noi.openjudge.cn/ch0401/1625/

描述

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是奇数,那么序列的中位数是序列排序后中间的数。一个注意到的地方是如果序列从一开始编号,那么在这种情况下的中位数是序列排序后编号为(n+1)/2的值。如果N是偶数,序列的中位数是序列排序后中间两个数的平均数。但原序列可能没被排序。

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.

你应该输出保留小数点后一位的中位数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值