题解:排序取中位数,然后与平均数比较即可。

#include <cstdio>
#include <algorithm>
using namespace std;
double a[1005],ave,med,sum; int n;
int main(){
while(~scanf("%d",&n)){
sum=0;
for(int i=1;i<=n;i++){scanf("%lf",&a[i]);sum+=a[i];}
sort(a+1,a+n+1);
med=a[(n+1)/2];
ave=sum/(double)n;
if(med<=ave)puts("NO");else puts("YES");
}return 0;
}

HDU 4981 Goffi and Median的更多相关文章

  1. HDU 4981 Goffi and Median(水)

    HDU 4981 Goffi and Median 思路:排序就能够得到中间数.然后总和和中间数*n比較一下就可以 代码: #include <cstdio> #include <c ...

  2. HDU 4982 Goffi and Squary Partition(推理)

    HDU 4982 Goffi and Squary Partition 思路:直接从全然平方数往下找,然后推断是否能构造出该全然平方数,假设能够就是yes,假设都不行就是no.注意构造时候的推断,因为 ...

  3. hdu 4983 Goffi and GCD(数论)

    题目链接:hdu 4983 Goffi and GCD 题目大意:求有多少对元组满足题目中的公式. 解题思路: n = 1或者k=2时:答案为1 k > 2时:答案为0(n≠1) k = 1时: ...

  4. HDU 4983 Goffi and GCD(数论)

    HDU 4983 Goffi and GCD 思路:数论题.假设k为2和n为1.那么仅仅可能1种.其它的k > 2就是0种,那么事实上仅仅要考虑k = 1的情况了.k = 1的时候,枚举n的因子 ...

  5. hdu 4982 Goffi and Squary Partition

    Goffi and Squary Partition Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Subm ...

  6. hdu 4983 Goffi and GCD(欧拉函数)

    Problem Description Goffi is doing his math homework and he finds an equality on his text book: gcd( ...

  7. HDU 4983 Goffi and GCD

    题目大意:给你N和K,问有多少个数对满足gcd(N-A,N)*gcd(N-B,N)=N^K.题解:由于 gcd(a, N) <= N,于是 K>2 都是无解,K=2 只有一个解 A=B=N ...

  8. hdu 4981

    中位数是否大于平均数 水题 #include <cstdio> #include <cstdlib> #include <cmath> #include <c ...

  9. HDU题解索引

    HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsu ...

随机推荐

  1. JVM学习之内存分配一

    转自:http://blog.csdn.net/mazhimazh/article/details/16879055,多谢博主分享 我们知道计算机的基本构成是:运算器.控制器.存储器.输入和输出设备, ...

  2. svn服务器配置小记

    在这里/opt/svndata/repos1创建svn版本库svnadmin create /opt/svndata/repos1 创建成功后会在/opt/svndata/repos1目录下生成con ...

  3. jQuery 源码分析和使用心得 - core.js

    core是jQuery的核心内容, 包含了最基础的方法, 比如我们常用的 $(selector, context), 用于遍历操作的 each, map, eq, first 识别变量类型的 isAr ...

  4. function(ev) //括号里的ev是什么东西,什么意思?

    事件对象: 楼上的不要误导新人 ev是我们获取事件详细信息的event是IE的写法 大多数人是写window.event 其实区别也差不多 好像window.event更安全些 我也不记得了 火狐呢 ...

  5. sf

    #include <stdio.h> #include <time.h> #include <stdlib.h> #define MAXN 150 //最大节点数 ...

  6. JS中特殊句子-for in

    for(var i=0;i<len;i++)这样的用法一般都可以用for in 来替代. 例如: var a = ["a","b","c&quo ...

  7. 利用指针突破C++编译器的防线

    C++ 面向对象的一大特性就是封装,使用不同的访问控制符来控制外接对其的访问权限.比如: class A { public: A(): i(){} void print(){ cout << ...

  8. ulimit 说明

    ulimit官方描述 Provides control over the resources available to the shell and to processes started by it ...

  9. [LeetCode][Python]14: Longest Common Prefix

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest ...

  10. hdu-4468-Spy-KMP+贪心

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4468 题目意思: 给你一个串r,求一个串s,使得s的前缀1+s的前缀2+s的前缀3+...+s的前缀 ...