HDU5835
Danganronpa
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 570 Accepted Submission(s): 414
Problem Description
1. Each table will be prepared for a mysterious gift and an ordinary gift.
2. In order to reflect the Chisa Yukizome's generosity, the kinds of the ordinary gift on the adjacent table must be different.
3. There are no limits for the mysterious gift.
4. The gift must be placed continuously.
She wants to know how many students can get gifts in accordance with her idea at most (Suppose the number of students are infinite). As the most important people of her, you are easy to solve it, aren't you?
Input
Each case contains one integer n. The next line contains n (1≤n≤10) numbers: a1,a2,...,an, (1≤ai≤100000).
Output
Sample Input
Sample Output
//2016.8.16
#include<iostream>
#include<cstdio>
#include<algorithm> using namespace std; int a[]; int main()
{
int T, n, kase = , sum, mx, ans;
cin>>T;
while(T--)
{
sum = mx = ;
scanf("%d", &n);
for(int i = ; i < n; i++)
{
scanf("%d", &a[i]);
sum += a[i];
if(mx<a[i])mx = a[i];
}
printf("Case #%d: ", ++kase);
ans = min(sum/, *(sum-mx)+);
printf("%d\n", ans);
} return ;
}
HDU5835的更多相关文章
随机推荐
- APPIUM安装与搭建Q&A
APPIUM安装与搭建Q&A Q1:在线安装TESTNG插件时,出现安装失败,提示:Cannot complete the install because one or more requir ...
- hibernate--ID生成策略--XML
xml生成id, a) generator b) 常用4个: native, uuid, identity, sequence 1. 新建java项目, 引入hibernate, junit(use ...
- CMU机器学习课程-简介
CMU在机器学习研究领域大名鼎鼎,Tom Mitchell 即是该学校老师.学校开设有机器学习课程.如今机器学习应用的领域越来越广泛,之前传统的<机器学习>课程,现在分成一般非机器学习领域 ...
- [Java]局域网五子棋
提示: 下面给的代码有问题哦,可以自己去调试 可用版下载 请点击这里 密码:x6ve(退出程序,端口并没有被关闭,可自行修改代码实现) img
- 21、手把手教你Extjs5(二十一)模块Form的自定义的设计
前面几节完成了模块Grid的自定义,模块Form自定义的过程和Grid的过程类似,但是要更复杂一些.先来设计一下要完成的总体目标. 1、可以有多个Form方案,对应于显示.新增.修改.审核.审批等功能 ...
- iOS 代码实现获得应用的版本号(Version/Build)
http://www.open-open.com/lib/view/open1411817778203.html
- WPF 制作电子相册浏览器
周末的时候,闲着无聊,做了一个电子相册浏览器.比较简单.界面如下: 主要部分代码如下: MainWindow.xaml <local:HeaderedWindow x:Class="P ...
- TCP/IP 标志位 SYN ACK RST UTG PSH FIN
三次握手:发送端发送一个SYN=1,ACK=0标志的数据包给接收端,请求进行连接,这是第一次握手:接收端收到请求并且允许连接的话,就会发送一个 SYN=1,ACK=1标志的数据包给发送端,告诉它,可以 ...
- Elasticsearch的使用场景深入详解
了解了ES的使用场景,ES的研究.使用.推广才更有价值和意义. 1.场景-:使用Elasticsearch作为主要的后端 传统项目中,搜索引擎是部署在成熟的数据存储的顶部,以提供快速且相关的搜索能力. ...
- p4factory 解决“g++: internal compiler error: Killed (program cc1plus)” make error问题
参考:解决: g++: internal compiler error: Killed (program cc1plus) 在安装p4factory的时候,执行: ./install_deps.sh ...