标题:一道很简单的acm题目求中位数
只看楼主
wj980507
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2017-7-10
 问题点数:0 回复次数:2 
一道很简单的acm题目求中位数
Description


Figure out the median of a floating point number array. If the size of an array is an odd number, the median is the middle element after arranging all the array elements from lowest value to highest value; If there is an even number of elements, then there is no single middle value, so the median is the mean of the two middle values.


Input


The input may contain several test cases.

The first line of each test case is an integer n (n >= 1), representing the size of the array.

The second line of each test case contains all the elements in the array.

Input is terminated by EOF.


Output


For each test case, output the median , which must be formatted as a floating point number with exactly two digit after the decimal point.
搜索更多相关主题的帖子: the number array middle test 
2017-07-10 20:59
wj980507
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2017-7-10
得分:0 
求大佬解答,我不是很会它要求的输入,怎么这样输入多组数据啊
2017-07-10 20:59
九转星河
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:长长久久
等 级:贵宾
威 望:52
帖 子:5023
专家分:14003
注 册:2016-10-22
得分:0 
while (scanf("%d",&n,)!=EOF){}这样?~

[code]/*~个性签名:bug是什么意思?bug是看上去没有可能的东西实际上是有可能做到的 就是这样~2018-08-08更~*/[/code]
2017-07-11 07:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-479306-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.150648 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved