HDU 4981 Goffi and Median
题解:排序取中位数,然后与平均数比较即可。
#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的更多相关文章
- HDU 4981 Goffi and Median(水)
HDU 4981 Goffi and Median 思路:排序就能够得到中间数.然后总和和中间数*n比較一下就可以 代码: #include <cstdio> #include <c ...
- HDU 4982 Goffi and Squary Partition(推理)
HDU 4982 Goffi and Squary Partition 思路:直接从全然平方数往下找,然后推断是否能构造出该全然平方数,假设能够就是yes,假设都不行就是no.注意构造时候的推断,因为 ...
- hdu 4983 Goffi and GCD(数论)
题目链接:hdu 4983 Goffi and GCD 题目大意:求有多少对元组满足题目中的公式. 解题思路: n = 1或者k=2时:答案为1 k > 2时:答案为0(n≠1) k = 1时: ...
- HDU 4983 Goffi and GCD(数论)
HDU 4983 Goffi and GCD 思路:数论题.假设k为2和n为1.那么仅仅可能1种.其它的k > 2就是0种,那么事实上仅仅要考虑k = 1的情况了.k = 1的时候,枚举n的因子 ...
- hdu 4982 Goffi and Squary Partition
Goffi and Squary Partition Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Subm ...
- hdu 4983 Goffi and GCD(欧拉函数)
Problem Description Goffi is doing his math homework and he finds an equality on his text book: gcd( ...
- 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 ...
- hdu 4981
中位数是否大于平均数 水题 #include <cstdio> #include <cstdlib> #include <cmath> #include <c ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
随机推荐
- leetcode Binary Tree Paths python
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = ...
- 检测android机器是否有GPS模块
public boolean hasGPSDevice(Context context) { final LocationManager mgr = (LocationManager)context. ...
- 关于webapp中的文字单位的一些捣腾
前言 文字是网页内容的一枚大将,我们无时无刻都在看着它,只要是你盯屏幕上的任何一个地方都会有文字.地铁上无时无刻都在盯着屏幕上的人对于文字更为敏感,太大不行,太小TN又看不清上面到底在说什么,有时候车 ...
- Android 内存管理之优化建议
OOM(OutOfMemory)转:http://hukai.me/android-performance-oom/ 前面我们提到过使用getMemoryClass()的方法可以得到Dalvik He ...
- Android viewpager 嵌套 viewpager滑动 点击事件冲突解决方案
为了解决这个问题.可以自定义viewpager,然后在里面监听首饰,自定义点击事件 package com.hpuvoice.view; import android.content.Context; ...
- mini-httpd源码分析-match.h
//字符串匹配,匹配返回 1,否则返回 0. //pattern可以通过任意个 | 字符,组合match_one中pattern的功能 int match(const char* pattern, c ...
- [原创]反汇编之一:和Taskmgr过不去篇(无厘头版)
原文链接:和Taskmgr过不去篇(无厘头版) Hook入门级文章,主要想培养一下偶写文章的感觉,老鸟无视…我想看看技术文章能不能无厘头的写,如果效果不错的话,准备更上一层-----用我的原创漫画表达 ...
- 中标麒麟6.0_ICE3.4.2编译+demo测试(CPP)
(菜鸟版)确保 gcc版本4.4.6(其他版本未测试),4.8不行 一.降级GCC到4.4.6 注意:gcc g++ c++命令都为4.4.6(可用gcc -v; g++ -v; c++ -v 命令查 ...
- SQL Server 完成性检查的顺序
第一步: 默认值 第二步: 违反not null 限制 第三步: 判断check约束 第四步: 对引用表应用foreign key 检查 第五步: 对被引用表做 foreign key 检查 第六步: ...
- flex4 日期类型字符串转日期类型(string转Date)(转)
mysql数据库中存储的日期类型通过PHP返回到flex端为字符串类型,这样在flex中进行处理时就必须要将字符串转化为Date类型.如果仅仅是 "年/月/日" 的组合,而没有涉及 ...