博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 2388 Who's in the Middle
阅读量:4590 次
发布时间:2019-06-09

本文共 916 字,大约阅读时间需要 3 分钟。

Who's in the Middle
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 31149   Accepted: 18073

Description

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.

Input

* Line 1: A single integer N 
* Lines 2..N+1: Each line contains a single integer that is the milk output of one cow.

Output

* Line 1: A single integer that is the median milk output.

Sample Input

524135

Sample Output

3

#include
#include
using namespace std;int cmp(int x,int y){ if(x

转载于:https://www.cnblogs.com/bhlsheji/p/5320859.html

你可能感兴趣的文章
H3C IEEE 802.11无线局域网工作组
查看>>
H3C 802.11 MAC层工作原理
查看>>
H3C 802.11 WEP加密原理
查看>>
H3C 无线交换机和FIT AP的典型连接
查看>>
H3C FAT AP
查看>>
H3C STA>PC的数据转发
查看>>
H3C 无线交换机的数据转发原理
查看>>
redis Sorted set 相关命令
查看>>
redis Set相关命令
查看>>
基于物品的协同过滤(ItemCF)
查看>>
基于用户的协同过滤(UserCF)
查看>>
运行Storm实例
查看>>
MapReduce各个执行阶段
查看>>
Shuffle过程详解
查看>>
Amazon DynamoDB
查看>>
云数据库与其他数据库的关系
查看>>
Amazon AWS
查看>>
Amazon AWS EC2存储
查看>>
Amazon S3和EBS的区别
查看>>
AWS云管理平台
查看>>