hdu 4981
中位数是否大于平均数
水题
#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的更多相关文章
- HDU 4981 Goffi and Median(水)
HDU 4981 Goffi and Median 思路:排序就能够得到中间数.然后总和和中间数*n比較一下就可以 代码: #include <cstdio> #include <c ...
- HDU 4981 Goffi and Median
题解:排序取中位数,然后与平均数比较即可. #include <cstdio> #include <algorithm> using namespace std; double ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
随机推荐
- console.log等不能打印全部数据/信息
有时候console.log在chrome调试控制台打印不全,如下: 这个时候,我们可以点击进去:用watch 工具,添加变量,右击copy value 选项:
- MongoDB服务无法启动,发生服务特定错误:100
问题:MongoDB服务无法启动,发生服务特定错误:100 原因:没有正常关闭mongod服务,导致mongod被锁 解决方案:进入db文件夹,删除mongod.lock文件,然后重新启动服务即可
- switch_to_frame,切换frame框架
页面包含frame/iframe标签,需要先切换到该frame标签,再去定位属于这个frame的元素. 如果要再去定位其他frame的元素,需要回到该frame的上级,定位到要选择的frame,不 ...
- Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:generate (default-cli) on project : <properties> resource does not exist
使用mybatis-generator自动生成mapper.dao等文件时,报错如下: org.apache.maven.lifecycle.LifecycleExecutionException: ...
- Too Rich(贪心+DFS)
Too Rich http://acm.hdu.edu.cn/showproblem.php?pid=5527 Time Limit: 6000/3000 MS (Java/Others) Me ...
- 【校招面试 之 C/C++】第18题 C++ 中的隐式转换以及explicit关键字
1.什么是隐式转换: 众所周知,C++的基本类型中并非完全的对立,部分数据类型之间是可以进行隐式转换的. 所谓隐式转换,是指不需要用户干预,编译器私下进行的类型转换行为.很多时候用户可能都不知道进行了 ...
- Raft 一致性算法论文译文
本篇博客为著名的 RAFT 一致性算法论文的中文翻译,论文名为<In search of an Understandable Consensus Algorithm (Extended Vers ...
- OpenSSL基础知识
1.openssl里的fips是什么意思? openssl-fips是符合FIPS标准的Openssl. 联邦信息处理标准(Federal Information Processing Standar ...
- Linux Doxygen的安装和使用
一.简介 Doxygen是一种开源跨平台的,以类似JavaDoc风格描述的文档系统,完全支持C.C++.Java.Objective-C和IDL语言,部分支持PHP.C#.注释的语法与Qt-Doc.K ...
- Laravel 加载自定义的 helpers.php 函数
Laravel 提供了很多 辅助函数,有时候我们也需要创建自己的辅助函数. 必须 把所有的『自定义辅助函数』存放于 bootstrap 文件夹中. 并在 bootstrap/app.php 文件的最顶 ...