中位数是否大于平均数

水题

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define clr0(x) memset(x,0,sizeof(x))
typedef long long LL;
const int maxn = 1<<20;
int s[maxn],n; int main() {
// int _;RD(_);while(_--){
// ;
// }
while(~RD(n)){
int avg = 0;
for(int i = 0;i < n;++i){
RD(s[i]);
avg += s[i];
}
avg /= n;
sort(s,s+n);
if(avg < s[(n+1)/2 - 1])
puts("YES");
else
puts("NO");
}
return 0;
}

hdu 4981的更多相关文章

  1. HDU 4981 Goffi and Median(水)

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

  2. HDU 4981 Goffi and Median

    题解:排序取中位数,然后与平均数比较即可. #include <cstdio> #include <algorithm> using namespace std; double ...

  3. HDU题解索引

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

  4. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  6. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  7. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  8. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  9. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

随机推荐

  1. shell 一次移动很多个命名相似的文件

    文件夹下面有很多类似下面命名的文件 aaaaaa01bbb aaaaaa01cc aaaaaa01dd aaaaaa02bbb aaaaaa02cc 要把 aaaaaa01 的文件移走 用 mv  / ...

  2. idea 打包java程序

    创建maven项目 在pom.xml中添加: <build> <plugins> <plugin> <groupId>org.apache.maven. ...

  3. 使用UUID方法生成全球唯一标识

    需要生成唯一字符串,如生成应用标识等,可以直接用java.util.UUID类实现. UUID(Universally Unique Identifier)全局唯一标识符,是指在一台机器上生成的数字, ...

  4. racktables 的介绍及搭建指南

    Racktables RackTables称自己为一个“机架空间.IP地址.服务器.交换机.路由器等 的管理框架”.它拥有一个web界面,执行报告和配置,并管理名字服务.RackTables以PHP5 ...

  5. 取消svn add

    svn commit之前,add的东西都可以取消. 通过先执行svn cleanup,再执行svn revert --recursive example_folder.

  6. Python3 chr() 函数

    Python3 chr() 函数 Python3 内置函数 描述 chr() 用一个整数作参数,返回一个对应的字符. 语法 以下是 chr() 方法的语法: chr(i) 参数 i -- 可以是 10 ...

  7. mongo远程登录

    1. 进入数据库: use admin db.addUser("foo","foo"); ps:高版本用db.createUser创建. 2. 改配置 如/et ...

  8. Fragment----静态创建碎片

    import android.os.Bundle; import android.app.Activity; import android.app.Fragment; import android.a ...

  9. C#中int? 转换为 int 型

    用 “ var a= zongfen.Score;”

  10. Bioconductor简介

    Bioconductor简介 2012-10-09 ~ ADMIN 源:Bioconductor: open software development for computational biolog ...