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 [题目类型]矩阵快速幂 &题解: 这是一个模板题,也算是入门了吧. 推荐一个博客:点这里 跟 ...
随机推荐
- 一个js 变量作用域问题
一个js 域问题,有一本书 叫 javasrcip pattert 好像是,写的很好,, <!DOCTYPE html> <html> <head lang=" ...
- (ASP页面查询等待提示效果)GridViewなどで検索中に「処理中メッセージ」を表示する方法(※他の長い時間処理も参照できる)
原博客 http://ino1970.blog119.fc2.com/blog-entry-163.html GridViewなどで検索中に「処理中メッセージ」を表示する方法 「GridViewなどで ...
- 使用linq获得当前文件夹下的下一级满足条件的文件夹
使用linq获得当前文件夹下的下一级满足条件的文件夹. SPFolderCollection subAlbums = Folder.SubFolders; ...
- Centos6.5 安装 MariaDB-10.0.20-linux-x86_64.tar.gz
下载mariadb :https://downloads.mariadb.org/ 我选择mariadb-10.0.20-linux-x86_64.tar.gz这个版本 复制安装文件 /opt 目录 ...
- js中push()方法
直接上代码: var roleIdsTemp = []; $("#addRole .modalcheckbox-all").each(function(key, value) { ...
- ios专题 - GCD(1)
什么是GCD? Grand Central Dispatch或者GCD,是一套低层API,提供了一种新的方法来进行并发程序编写.从基本功能上讲,GCD有点像 NSOperationQueue,他们都允 ...
- Fast Report Data Filter
使用Data Filter两种方式:一种是 直接在Filter 属性里写表达式 ,另外一种就是在beforePrint 事件里写方法. 今天开发时遇到了一个Filter的问题,不知道是不是fast r ...
- 复选框字段数组拆分后循环选项值,if判断根据选项值,前端输出html
{php $specials = explode(',',$r[special]);} <div class="special"> {loop $specials $s ...
- php模块参考
<?php //数据库连接类 class ConnDB{ var $dbtype; var $host; var $user; var $pwd; var $dbname; //构造方法 fun ...
- directUI
MFC界面开发中,习惯了使用控件,亦或者是自绘制控件来美化界面,但操作起来繁琐,还不太美观.DirectUI的出现,对于界面开发,给了我们一个新的选择,目前很多公司使用了该技术对其产品进行了美化,效果 ...