HDU-4974 A simple water problem
http://acm.hdu.edu.cn/showproblem.php?pid=4974
话说是签到题,我也不懂什么是签到题。
A simple water problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 196 Accepted Submission(s):
124
competition is held between two competitors, and surely Dragon's favorite. After
each competition he will give a score of either 0 or 1 for each competitor and
add it to the total score of that competitor. The total score begins with zero.
Here's an example: four competitors with name James, Victoria, Penghu, and Digo.
First goes a competition between Penghu and Digo, and Dragon enjoys the
competition and draw both 1 score for them. Then there’s a competition between
James and Victoria, but this time Dragon draw 1 for Victoria and 0 for James.
Lastly a competition between James and Digo is held, but this time Dragon really
dislike the competition and give zeroes for each of them. Finally we know the
score for each one: James--0, Victoria--1, Penghu--1, Digo--1. All except James
are the Winner!
However, Dragon's mom comes back home again and close the
TV, driving Dragon to his homework, and find out the paper with scores of all
competitors. Dragon's mom wants to know how many competition Dragon watched, but
it's hard through the paper. Here comes the problem for you, given the scores of
all competitors, at least how many competitions had Dragon watched?
T(<=10), the number of test cases. Following T blocks, each block describe
one test case.
For each test case, the first line contains only one
integers N(<=100000), which means the number of competitors. Then a line
contains N integers
(a1,a2,a3,...,an).ai(<=1000000)
means the score of i-th competitor.
start with "Case #i: ", with i implying the case number. Then for each case just
puts a line with one integer, implying the competition at least should be
watched by dragon.
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int a[];
int main()
{
int n,t,k=,i,sum,mmax;
scanf("%d",&t);
while(t--)
{
sum=mmax=;
scanf("%d",&n);
for(i=;i<n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
if(mmax<a[i])
mmax=a[i];
}
int ans=max((sum+)/,mmax);
printf("Case #%d: %d\n",k++,ans);
}
return ;
}
HDU-4974 A simple water problem的更多相关文章
- HDU 4974 A simple water problem(贪心)
HDU 4974 A simple water problem pid=4974" target="_blank" style="">题目链接 ...
- hdu - 4974 - A simple water problem(贪心 + 反证)
题意:N个队(N <= 100000),每一个队有个总分ai(ai <= 1000000),每场比赛比赛两方最多各可获得1分,问最少经过了多少场比赛. 题目链接:http://acm.hd ...
- 2014多校第十场1004 || HDU 4974 A simple water problem
题目链接 题意 : n支队伍,每场两个队伍表演,有可能两个队伍都得一分,也可能其中一个队伍一分,也可能都是0分,每个队伍将参加的场次得到的分数加起来,给你每个队伍最终得分,让你计算至少表演了几场. 思 ...
- HDOJ 4974 A simple water problem
A simple water problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
- HDU 4978 A simple probability problem
A simple probability problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K ( ...
- HDU 1757 A Simple Math Problem 【矩阵经典7 构造矩阵递推式】
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=1757 A Simple Math Problem Time Limit: 3000/1000 MS (J ...
- hdu 1757 A Simple Math Problem (乘法矩阵)
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU 1757 A Simple Math Problem (矩阵快速幂)
题目 A Simple Math Problem 解析 矩阵快速幂模板题 构造矩阵 \[\begin{bmatrix}a_0&a_1&a_2&a_3&a_4&a ...
- HDU 1757 A Simple Math Problem(矩阵)
A Simple Math Problem [题目链接]A Simple Math Problem [题目类型]矩阵快速幂 &题解: 这是一个模板题,也算是入门了吧. 推荐一个博客:点这里 跟 ...
随机推荐
- Bootstarp--全局CSS样式之表格
表格在实际开发中可以说是非常常见的,但是有很多人不喜欢使用表格,但个人觉得在简单的界面布局中使用表格还是很简单的.毕竟人家给了表格这元素,而你却不去使用,貌似有点不解风情. 下面简单介绍Bootstr ...
- 解决 TortoiseGit 诡异的 Bad file number 问题
http://blog.csdn.net/renfufei/article/details/41648061 问题描述 昨天,以及今天(2014-11-29),使用 TortoiseGit 时碰到了一 ...
- JAVA 函数式接口与c#委托对应关系(一)
C# Action委托 VS JAVA Action 接口函数 1.c#:Action 封装一个方法,该方法不具有参数并且不返回值. 构造实体类类 using System; namespace Ac ...
- SQL大量数据查询的优化 及 非用like不可时的处理方案
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...
- Java 对象属性的遍历
package com.cn.mybatis.test; import java.io.IOException; import java.io.InputStream; import java.lan ...
- html-----006
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- ThinkPHP调试模式与日志记录
1.可以在config.php中进行设置,默认为关闭状态. 'APP_DEBUG' => true 打开\ThinkPHP\Common\debug.php文件可以查看debug的默认设置 ...
- Eclipse debug调试
Eclipse debug调试: F5:跳入方法F6:向下逐行调试F7:跳出方法F8:直接跳转到下一个断点
- ava下static关键字用法详解
Java下static关键字用法详解 本文章介绍了java下static关键字的用法,大部分内容摘自原作者,在此学习并分享给大家. Static关键字可以修饰什么? 从以下测试可以看出, static ...
- Ext.Array 方法
1. Ext.Array.clean(arr); 过滤数组中的空元素 var arr = [1,"",2,"",3]; Ext.clean(arr); // [ ...