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

Problem Description
Dragon is watching competitions on TV. Every
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?

 
Input
The first line of input contains only one integer
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.

 
Output
Each output should occupy one line. Each line should
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.
 
Sample Input
1
3
2 3 4
 
Sample Output
Case #1: 5
 
Source
#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的更多相关文章

  1. HDU 4974 A simple water problem(贪心)

    HDU 4974 A simple water problem pid=4974" target="_blank" style="">题目链接 ...

  2. hdu - 4974 - A simple water problem(贪心 + 反证)

    题意:N个队(N <= 100000),每一个队有个总分ai(ai <= 1000000),每场比赛比赛两方最多各可获得1分,问最少经过了多少场比赛. 题目链接:http://acm.hd ...

  3. 2014多校第十场1004 || HDU 4974 A simple water problem

    题目链接 题意 : n支队伍,每场两个队伍表演,有可能两个队伍都得一分,也可能其中一个队伍一分,也可能都是0分,每个队伍将参加的场次得到的分数加起来,给你每个队伍最终得分,让你计算至少表演了几场. 思 ...

  4. HDOJ 4974 A simple water problem

    A simple water problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/O ...

  5. HDU 4978 A simple probability problem

    A simple probability problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

  6. 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 ...

  7. hdu 1757 A Simple Math Problem (乘法矩阵)

    A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  8. HDU 1757 A Simple Math Problem (矩阵快速幂)

    题目 A Simple Math Problem 解析 矩阵快速幂模板题 构造矩阵 \[\begin{bmatrix}a_0&a_1&a_2&a_3&a_4&a ...

  9. HDU 1757 A Simple Math Problem(矩阵)

    A Simple Math Problem [题目链接]A Simple Math Problem [题目类型]矩阵快速幂 &题解: 这是一个模板题,也算是入门了吧. 推荐一个博客:点这里 跟 ...

随机推荐

  1. angularJs 使用中遇到的问题小结【一:关于传参】

    我请教个问题 :我在界面传了一个参数<a ng-click="deleteOrder({{orderOrder}})" class="btn warning-btn ...

  2. java 开发基础篇1环境安装--eclipse安装教程

    如何安装java环境 http://jingyan.baidu.com/article/a24b33cd59b58e19fe002bb9.html JDK download http://www.or ...

  3. mvc 路由 使用

    url 特性路由: 特性路由可以在 controller和action里面自定义路由规则  这种方式比较灵活  缺点就是不能很好的统一管理url 注册特性路由: public static void ...

  4. T-SQL中的透视和逆透视

    透视 今天抽一点时间来看看透视和逆透视语句,简单的说就是行列转换.假设一个销售表中存放着产品号,产品折扣,产品价格三个列,每一种产品号可能有多种折扣,每一种折扣只对应一个产品价格.下面贴出建表语句和插 ...

  5. yieId浅谈

    例子:在不使用yieId时,通常我们都会采取先遍历再把元素加到新的List中 using (var reader = SqlHelper.ExecuteReader("")) { ...

  6. java开发规范总结_代码注释规范

    规范需要平时编码过程中注意,是一个慢慢养成的好习惯 1.基本规则 1.注释应该使代码更加清晰易懂   2.注释要简单明了,只要提供能够明确理解程序所必要的信息就可以了.如果注释太复杂说明程序需要修改调 ...

  7. Java中I/O的分析

    Java中I/O的原理: 在java程序中,对于数据的输入/输出操作以”流“的方式进行的. 流是内存中一组有序数据序列 Java将数据从源读入到内存当中,形成了流,然后这些流可以写到目的地. Java ...

  8. 利用c语言做简单的迷宫小游戏

                       #include <stdio.h> #define ROW 6 #define COL 6 // 封装打印地图的函数 void printMap(c ...

  9. Fast Report Data Filter

    使用Data Filter两种方式:一种是 直接在Filter 属性里写表达式 ,另外一种就是在beforePrint 事件里写方法. 今天开发时遇到了一个Filter的问题,不知道是不是fast r ...

  10. 移动端日期控件 mobiscroll

    Mobiscroll是一个用于触摸设备(Android phones, iPhone, iPad, Galaxy Tab)的日期和时间选择器jQuery插件.可以让用户很方便的只需要滑动数字既可以选择 ...