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的更多相关文章
随机推荐
- 15个最佳jQuery的翻页书效果的例子
在这里,你会发现15的jQuery的翻页书的插件,提供了良好的页面翻转的经验,并帮助创建类似书本的效果. jQuery的增添了一道亮丽的过渡到实际的页面在一本书或杂志HTML5. 1. BookBlo ...
- Java模拟post提交表单数据
package test; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOExcep ...
- Spring的5种事物配置方式
Spring事务配置的五种方式 前段时间对Spring的事务配置做了比较深入的研究,在此之间对Spring的事务配置虽说也配置过,但是一直没有一个清楚的认识.通过这次的学习发觉Spring的事务配置只 ...
- hibernate---一对一单向外键关联--annotation (重要!!!)
1. 生成wife.java: package com.bjsxt.hibernate; import javax.persistence.Entity; import javax.persisten ...
- typedef和block
为block类型对象取别名 1.没有使用typedef的情况 int (^block_add)(int, int) = ^(int value1, int value2) { return value ...
- iOS开发之隐藏tabbar--解决隐藏后依然不能响应对应位置事件的问题
状态条StatusBar 1 [UIApplication sharedApplication].statusBarHidden = YES; 导航条NavigationBar 1 [self.nav ...
- WKWebKit基础
UIWebView & UIWebViewDelegate 这个两个东西在 WKWebKit 中被重构成 14 个类 3 个协议. WKWebKit Framework Classes WKB ...
- 51nod贪心算法教程
51nod确实是一个好oj,题目质量不错,wa了还放数据,学习算法来说挺好的,这次我做了几个水的贪心,虽然水,但是确实都很典型. 教程链接:http://www.51nod.com/tutorial/ ...
- iOS 页面跳转,离开之前pop掉navigationController栈中的页面
http://blog.csdn.net/worldzhy/article/details/41312713 - (void)viewDidDisappear:(BOOL)animated { //因 ...
- [转]SQL Server® 2008 R2 Express 静默安装
1. http://msdn.itellyou.cn/下载Express版SQL Server 2.快捷键win+R,进入CMD,解压文件,解压命令为 <文件名>.exe /x <解 ...