HDU 4981 Goffi and Median(水)
HDU 4981 Goffi and Median
思路:排序就能够得到中间数。然后总和和中间数*n比較一下就可以
代码:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std; const int N = 1005; int n, a[N], sum; int main() {
while (~scanf("%d", &n)) {
sum = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
sum += a[i];
}
sort(a + 1, a + n + 1);
if (a[(n + 1) / 2] * n > sum) printf("YES\n");
else printf("NO\n");
}
return 0;
}
HDU 4981 Goffi and Median(水)的更多相关文章
- HDU 4981 Goffi and Median
题解:排序取中位数,然后与平均数比较即可. #include <cstdio> #include <algorithm> using namespace std; double ...
- 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 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5590 ZYB's Biology 水题
ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 4813 Hard Code(水题,2013年长春现场赛A题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4813 签到题. 把一个字符串按照格式输出就可以了,很水 #include <stdio.h> ...
- HDU 4847 陕西邀请赛A(水)
HDU 4847 Wow! Such Doge! pid=4847" style="">题目链接 题意:给定文本,求有几个doge,不区分大写和小写 思路:水题.直 ...
随机推荐
- LeetCode——TwoSum
题目: Given an array of integers, find two numbers such that they add up to a specific target number. ...
- signal()函数说明
表头文件#include<signal.h> 功 能:设置某一信号的对应动作 函数原型:void (*signal(int signum,void(* handler)(int)))(in ...
- ASP.NET aspx页面中 写C#脚本; ASP.NET 指令(<%@%>);
1 <h2>Welcome</h2> <ul> <% for (int i = 0; i <= Convert.ToInt32(ViewData[&qu ...
- 05-UIKit(UITableViewController)
目录: 一.UITableViewController(表视图控制器) 二.委托协议 三.tableview工作过程(三问一响应) 四.UITableViewCell 回到顶部 一.UITableVi ...
- JPA相关知识点滴--持续更新中.....
Java 持久化(JPA) •Java EE 5 在EJB 3.0 中包含JPA 1.0 •参考实现:TopLink Essentials •Java EE 6 包含JPA 2.0 •参考实现:Ec ...
- [zencart教程]zencart外贸建站仿站交流俱乐部
[zencart教程]zencart外贸建站仿站交流俱乐部 1.你想自主一天仿做一个精美的zencart 外贸网站; 2.你想自已自主定制精美的psd 图 zencart模板,并把它变成自定义精美 z ...
- C#面向对象1 类 以及 类的继承(new、ovverride)
类 的典型代码============================== 包括 属性及其判断赋值 方法 构造函数及其重载 ) { ...
- excel通过转成xml格式模板,下载成excel文件
源代码: report ztest_down_excel. data: begin of i_file occurs , val() type c, end of i_file. data begin ...
- java class生成jar包(转)
进入dos操作符窗口cd进入要打成jar包的class文件所有文件夹目录jar cvf [生成jar的名称.jar] [列出class文件] //若有多个,以空隔隔开 如:一.操作零散的单个或几个cl ...
- AspNet MVC4 教学-22:Asp.Net MVC4 Partial View 技术高速应用Demo
A.创建Basic类型的MVC项目. B.Model文件夹下,创建文件: LoginModel.cs: using System; using System.Collections.Generic; ...