思路:不想说了。。具体看代码。。。

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <algorithm>
  5. #include <math.h>
  6. #include <queue>
  7. #include <stack>
  8. using namespace std;
  9. #define INF 0x3f3f3f
  10. #define pi acos(-1.0)
  11. #define MAX 110
  12. #define mod 9973
  13. #define ll long long
  14. int n,m;
  15. int a[MAX];
  16. int main()
  17. {
  18. int t,i,j,k;
  19. scanf("%d",&t);
  20. for(k=1;k<=t;k++)
  21. {
  22. scanf("%d",&n);
  23. int sum=0;
  24. for(i=1;i<=n;i++)
  25. {
  26. scanf("%d",&a[i]);
  27. sum+=a[i];
  28. }
  29. printf("Case #%d: ",k);
  30. if(n==1)
  31. {
  32. if(a[1]>=2)
  33. printf("1\n");
  34. else
  35. printf("0\n");
  36. continue;
  37. }
  38. sort(a+1,a+n+1);
  39. if(a[n]<=3*(sum-a[n]))
  40. printf("%d\n",sum/2);
  41. else
  42. {
  43. if(a[n]-3*(sum-a[n])>=2)
  44. printf("%d\n",(sum-a[n])*2+1);
  45. else
  46. printf("%d\n",(sum-a[n])*2);
  47. }
  48. }
  49. return 0;
  50. }

hdoj5835【水题】的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  3. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  4. [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 ...

  5. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  6. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  7. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  8. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

  9. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

  10. CF451B Sort the Array 水题

    Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...

随机推荐

  1. stl_内存基本处理工具

    内存基本处理工具 STL定义5个全局函数.作用于初始化空间上.各自是:用于构造的construct(),用于析构的destroy(),uninitialized_copy(),uninitialize ...

  2. Android兼容性测试CTS

     一.简介 为了确保Android应用能够在所有兼容Android的设备上正确运行,并且保持相似的用户体验,在每个版本发布之时,Android提供了一套兼容性测试用例集合(Compatibility ...

  3. openwrt: sysupgrade

    sysupgrade 用法: sysupgrade [...] sysupgrade [-q] [-i] 升级选项: -d 重启前等待 delay 秒 -f 从 .tar.gz (文件或链接) 中恢复 ...

  4. ajax的异步操作及页面重定向跳转

    今天主要分享一个简单的ajax的异步操作数据,用javascript也有一段时间了,刚开始看到一些页面在没有页面刷新的情况下就可以实现数据的保存或者获取,觉得挺不可思议的,感觉速度很快,做了几个项目之 ...

  5. java中InputStream String

    Java 中获取输入流时,有时候须要将输入流转成String,以便获取当中的内容 ,以下总结一下 InputStream 转成String 的方式  方法1: public String conver ...

  6. HDU 6183 Color it cdq分治 + 线段树 + 状态压缩

    Color it Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Pro ...

  7. bash shell中的特殊用法

    1 ${BASH_SOURCE-$0} 表示当前正在执行的脚本的完整路径. 2 cd -P 以物理路径进入 /usr/localhadoop现在链到/home/houzhizhen/usr/local ...

  8. [rabbitmq-discuss] Exactly Once Delivery

    [rabbitmq-discuss] Exactly Once Delivery http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2010-A ...

  9. 秒懂单链表及其反转(reverse)

    什么是链表,这种数据结构是由一组Node组成的,这群Node一起表示了一个序列.链表是最普通,最简单的数据结构(物理地址不连续),它是实现其他数据结构如stack, queue等的基础. 链表比起数组 ...

  10. 自定义android 音乐通知栏 ——可伸缩扩展

    Android custom notification for music player Example   In this tutorial, you will learn how to creat ...