HDU 5835 Danganronpa
Danganronpa
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 406 Accepted Submission(s): 294
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?
Each case contains one integer n. The next line contains n (1≤n≤10) numbers: a1,a2,...,an, (1≤ai≤100000).
#include <cstdio>
#include <algorithm>
using namespace std; int a[15]; int main()
{
int t, n, cn = 0;
scanf("%d", &t);
while(t--){
scanf("%d", &n);
int sum = 0, m = 0;
for(int i = 0; i < n; ++i){
scanf("%d", &a[i]);
sum += a[i];
m = max(m, a[i]);
}
int res = min(sum/2, (sum-m)*2+1);
printf("Case #%d: %d\n", ++cn, res);
}
return 0;
}
HDU 5835 Danganronpa的更多相关文章
- HDU 5835 Danganronpa(弹丸论破)
Danganronpa(弹丸论破) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Other ...
- HDU 5835 Danganronpa (贪心)
Danganronpa 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5835 Description Chisa Yukizome works as ...
- HDU 5835 Danganronpa 贪心
Danganronpa 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5835 Description Chisa Yukizome works as ...
- HDU 5835 Danganronpa (水题)
题意:给定 n 个礼物有数量,一种是特殊的,一种是不特殊的,要分给一些人,每人一个特殊的一个不特殊,但是不特殊的不能相邻的,问最多能分给多少人. 析:是一个比较简单的题目,我们只要求差值就好,先算第一 ...
- [ An Ac a Day ^_^ ] hdu 5835 Danganronpa 令人发指
这道题告诉我两个道理: 1.记得写case 要不挂死你 2.数据很水的时候 只有样例的这一种情况…… 原来数据可以这么水…… #include<stdio.h> #include<i ...
- Hdu 5384 Danganronpa (AC自动机模板)
题目链接: Hdu 5384 Danganronpa 题目描述: 给出n个目标串Ai,m个模式串Bj,问每个目标串中m个模式串出现的次数总和为多少? 解题思路: 与Hdu 2222 Keywords ...
- 【HDU 5835】Danganronpa(分配礼物)
10种礼物,每种有ai个,每个小朋友分两个礼物,其中普通礼物要求相邻两人的不能一样,求最多分给几个小朋友. sum/2是最多的情况.什么时候发不了那么多,就是当max很大,无论怎么发,都发不完max. ...
- hdu 5384 Danganronpa
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5384 思路:没学自动机时以为是道KMP然后就tle了好几把,AC自动机模板题 #include<cs ...
- HDU 5384——Danganronpa——————【AC自动机】
Danganronpa Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
随机推荐
- What are Scopes?
scope is an object that refers to the application model. It is an execution context for expressions. ...
- 核稀疏表示分类(KSRC)
参考:<Kernel SparseRepresention-Based Classifier> 原文地址:http://www.cnblogs.com/Rosanna/p/3372153. ...
- JavaScript执行上下文
变量声明.函数声明为何会提升?js执行时是如何查找变量的?JavaScript中最基本的部分——执行上下文(execution context) 什么是执行上下文? 当JavaScript代码运行,执 ...
- String类的使用 Part2
StringBuilder 类的使用 属性: namespace StringBuilderTest { class Program { static void Main(string[] args) ...
- BZOJ 3198 SDOI2013 spring
为什么SDOI省选一年考两次容斥原理? 我们很容易发现>=k个相等时很好计算的 但是我们要求恰好k个,那么我们容斥即可 至于计算>=k个相等,首先我们枚举相等位置,对每个串对应位置做一遍h ...
- 高效的Nginx
FastCGI是将CGI解释器进程保持在内存中并因此获得较高的性能.CGI解释器的反复加载是CGI性能低下的主要原因. 如果CGI解释器保持在内存中并接受FastCGI管理器的调度,则可以提供良好的性 ...
- 转ATL对象类型
http://hi.baidu.com/rural_child/item/d91ce5d8fba9c8e73cc2cbf9 1.Objects a.Simple Object:用于实现业务逻辑,无用户 ...
- web rest api tools
https://chrome.google.com/webstore/search/postman-REST%20Client
- android4.4内核移植
01 init/目录下Kconfig修改: 956行添加: config PANIC_TIMEOUT int "Default panic timeout" help Set de ...
- Support Library官方教程(3)android studio中导入支援包
Support Library Setup How you setup the Android Support Libraries in your development project depend ...