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

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

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

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

Hint

INPUT DETAILS: 
Five cows with milk outputs of 1..5 
OUTPUT DETAILS: 
1 and 2 are below 3; 4 and 5 are above 3.

Source

 
#include 
#include
using namespace std;int getSort(int arr[],int N){ for(int i=0;i

 

转载于:https://www.cnblogs.com/dudulukeyxian/p/10639755.html

你可能感兴趣的文章
Part 2 - Fundamentals(4-10)
查看>>
使用Postmark测试后端存储性能
查看>>
NSTextView 文字链接的定制化
查看>>
第五天站立会议内容
查看>>
CentOs7安装rabbitmq
查看>>
(转))iOS App上架AppStore 会遇到的坑
查看>>
解决vmware与主机无法连通的问题
查看>>
做好产品
查看>>
项目管理经验
查看>>
笔记:Hadoop权威指南 第8章 MapReduce 的特性
查看>>
JMeter响应数据出现乱码的处理-三种解决方式
查看>>
获取设备实际宽度
查看>>
Notes on <High Performance MySQL> -- Ch3: Schema Optimization and Indexing
查看>>
Alpha冲刺(10/10)
查看>>
数组Array的API2
查看>>
为什么 Redis 重启后没有正确恢复之前的内存数据
查看>>
No qualifying bean of type available问题修复
查看>>
第四周助教心得体会
查看>>
spfile
查看>>
Team Foundation Service更新:改善了导航和项目状态速查功能
查看>>