当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4981:Goffi and Median

题目描述
A median in a sequence with the length of \(n\) is an element which occupies position number \(\Large\lfloor \frac{n + 1}{2} \rfloor\) after we sort the elements in the non-decreasing order (the elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.

An average of a sequence is the sum of sequence divided the size of the sequence.

Goffi likes median very much and he hates average number. So if a sequence's average number is larger than or equal to the median of sequence, Goffi will hate the sequence. Otherwise, Goffi will like it.

Now, your are given a sequence. Please find whether Goffi will like it or hate it.
输入解释
Input contains multiple test cases (less than 100). For each test case, the first line contains an integer \(n\) (\(1 \le n \le 1000\)), indicating the size of the sequence. Then in the next line, there are \(n\) integers \(a_1, a_2, \dots, a_n\) (\(1 \le a_i \le 1000\)), seperated by one space.
输出解释
For each case, if Goffi like the sequence, output "YES" in a line. Otherwise, output "NO".
输入样例
5
1 2 3 4 5
4
1 5 6 6
输出样例
NO
YES
来自杭电HDUOJ的附加信息
Recommend heyang

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #6

源链接: HDU-4981

最后修改于 2020-10-25T23:18:37+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)