hdoj5835【水题】
思路:不想说了。。具体看代码。。。
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <stack>
using namespace std;
#define INF 0x3f3f3f
#define pi acos(-1.0)
#define MAX 110
#define mod 9973
#define ll long long
int n,m;
int a[MAX];
int main()
{
int t,i,j,k;
scanf("%d",&t);
for(k=1;k<=t;k++)
{
scanf("%d",&n);
int sum=0;
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
printf("Case #%d: ",k);
if(n==1)
{
if(a[1]>=2)
printf("1\n");
else
printf("0\n");
continue;
}
sort(a+1,a+n+1);
if(a[n]<=3*(sum-a[n]))
printf("%d\n",sum/2);
else
{
if(a[n]-3*(sum-a[n])>=2)
printf("%d\n",(sum-a[n])*2+1);
else
printf("%d\n",(sum-a[n])*2);
}
}
return 0;
}
hdoj5835【水题】的更多相关文章
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
- CF451C Predict Outcome of the Game 水题
Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...
- CF451B Sort the Array 水题
Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...
随机推荐
- [Testing] Config jest to test Javascript Application -- Part 2
Setup an afterEach Test Hook for all tests with Jest setupTestFrameworkScriptFile With our current t ...
- 标C编程笔记day04 预处理、宏定义、条件编译、makefile、结构体使用
预处理:也就是包括须要的头文件,用#include<标准头文件>或#include "自己定义的头文件" 宏定义,如:#define PI 3.1415926 查看用宏 ...
- VS2012,VS2010无法生成dll程序集的解决办法
在我们做项目的时候总会遇到dll程序集无法生成导致各种问题. 通常我们的做法就是清理项目,然后重新生成,或者直接到bin目录下删除所有dll,然后重新生成. 有时候某几个dll就是不生成. 这时候就需 ...
- ubuntu 的权限和目录
/ : 根目录 /bin 和 /sbin中放置的是可执行文件 /etc 里面放的是配置文件 /boot 引导 /mnt 是挂载目录 /home 主目录 /dev 设备 /usr li ...
- Python 模块的安装与使用
我们知道使用函数不仅减轻了工作量,而且使代码更加简洁,更加的易于维护.但如果在另一个文件中,我们希望使用上一个文件中定义的某个函数,我们应该怎么办呢?我们需要重新将上一个函数再次实现一遍吗?而且,当我 ...
- C++ string 实现大整数相加减
随意两个大整数的加减算法.可自己主动推断正负号.代码例如以下: #include <iostream> #include <vector> #include <cstri ...
- 【Java架构学习】Model1和Model2讨论
在Java的学习中.这两个词的频率出现的非常高.那就是Model1和Model2.那么到底什么是Model1,什么是Model2呢?我们是不是又非常自然接受这两个概念.可是不知道其所以然呢?今天我们就 ...
- Android研究之游戏开发摄像头更新
游戏中摄像头的原理介绍 在游戏开发中更新摄像头的位置能够决定屏幕显示的内容,尤其是RPG类游戏摄像头有着很关键的数据.我举一个样例 有时候我们在玩RPG游戏的时候进入一个新的场景 ...
- Python开发【2.2 异常处理】
1.Python常见异常类型: Exception 常规错误的基类 AttributeError 对象没有这个属性 IOError 输入/输出操作失败 IndexError 序列中没有此索引(inde ...
- Spark 学习笔记:(二)编程指引(Scala版)
参考: http://spark.apache.org/docs/latest/programming-guide.html 后面懒得翻译了,英文记的,以后复习时再翻. 摘要:每个Spark appl ...