Problem q
2016-03-17 19:32
169 查看
FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as much or less.
Given an odd number of cows N (1 <= N < 10,000) and their milk output (1..1,000,000), find the median amount of milk given such that at least half the cows give the same amount of milk or more and at least half give the same or less.
这道题是最简单的一道,输入数组,排序,再把中间数输出 就行了。主要细节就是sort函数中排序规则的定义:bool cmp(int a,int b) return a>b;
Given an odd number of cows N (1 <= N < 10,000) and their milk output (1..1,000,000), find the median amount of milk given such that at least half the cows give the same amount of milk or more and at least half give the same or less.
这道题是最简单的一道,输入数组,排序,再把中间数输出 就行了。主要细节就是sort函数中排序规则的定义:bool cmp(int a,int b) return a>b;
相关文章推荐
- C语言中的static 详细分析
- JavaScript实现图片轮播
- 初学android
- Hadoop2.2.0 HA初体验
- 关于 md5 摘要
- Bzoj 2186: [Sdoi2008]沙拉公主的困惑 乘法逆元,线性筛,欧拉函数,数论
- NSCache详解
- Lab1--关于安装JUnit的简要描述
- 2 GPS utility methods
- 夺命雷公狗---DEDECMS----8dedecms干掉首页和-文档页-栏目页的页面的广告
- Linux学习5之查找文件中的某个字符串并返回所在行号
- vector 释放内存 swap
- 用android studio 开发一个aidl小例子,亲测可运行
- 连续函数的最大值的连续性
- vs2015安装及初步试用
- PingUtil in Android
- 两篇文章掌握Python语法和内置函数功能(第一篇)
- IP动态选路和最短路算法
- hdoj-1015-Safecracker--dfs--细心(剪枝要准确, 要么不剪枝, 别留下剪枝后遗症~)
- 微信开发准备工作