ps:  超级超级水的一道题....就是格式问题要注意...

除了第一个数据,其他的每个数据都要有个空行比如:

4

1 2 3 4

3

4

//这是空行

1 2 3 4

3

4

//这是空行

代码:

#include "stdio.h"
int main(){
int n,hi,i,sum,k,sum1,ncase=;
int a[];
while(~scanf("%d",&n) && n){
if(ncase++) {puts("");
}
sum=;
for(i=;i<n;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
k=sum/n;
sum1=;
for(i=;i<n;i++){
if(k<a[i]){
sum1+=a[i]-k;
}
}
printf("%d\n",sum1);
}
}

hdu 2088的更多相关文章

  1. HDU 2088 Box of Bricks

    http://acm.hdu.edu.cn/showproblem.php?pid=2088 Problem Description Little Bob likes playing with his ...

  2. HDU 2088 Box of Bricks(脑洞)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2088 Box of Bricks Time Limit: 1000/1000 MS (Java/Oth ...

  3. 『嗨威说』算法设计与分析 - 贪心算法思想小结(HDU 2088 Box of Bricks)

    本文索引目录: 一.贪心算法的基本思想以及个人理解 二.汽车加油问题的贪心选择性质 三.一道贪心算法题点拨升华贪心思想 四.结对编程情况 一.贪心算法的基本思想以及个人理解: 1.1 基本概念: 首先 ...

  4. HDOJ(HDU) 2088 Box of Bricks(平均值)

    Problem Description Little Bob likes playing with his box of bricks. He puts the bricks one upon ano ...

  5. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  6. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  7. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  8. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  9. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

随机推荐

  1. Neo4j 3.0 存储过程

    Neo4j 3.0 提供一个新的功能“存储过程”,该功能并不是Neo4j-Server的扩展,而是可以直接运行的. 在写这篇文章的时候,只能通过预备好的语句去执行 1 CALL package.pro ...

  2. cookie多次点赞效果

    <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...

  3. ftgl 绘制文字

    FTFont* ftfont = new FTGLPixmapFont(); ftfont->Open("D:/SIMHEI.ttf"); ftfont->FaceSi ...

  4. javascript中对象在OOP方面的一些知识(主要是prototype和__proto__相关)

    在ES6的Class到来之前,先总结下个人对js中prototype属性的理解. 1.构造函数(大写函数名  this 无return)   2.原型对象(函数.prototype)  3.实例对象( ...

  5. ARM: STM32F7: hardfault caused by unaligned memory access

    ARM: STM32F7: hardfault caused by unaligned memory access ARM: STM32F7: 由未对齐的内存访问引起的hardfault异常 Info ...

  6. 楼盘信息sq

    ID:1 楼盘名称:帝豪国际 网址:http://shangqiu.jiwu.com/loupan/239023.html 价格:2500元/平米 关注人数:497 地址:长寿大道南段 情况:在售 大 ...

  7. C# in depth学习(1)

    第一章,C#开发的进化史 1.简单数据类型 2.排序 Sorting an ArrayList using IComparer (C# 1) Sorting a List<Product> ...

  8. FastReport 自定义数据集

    1.可以自定义一个新的数据源   参考: internal class VirtualDataSource : DataSourceBase {    private int FVirtualRows ...

  9. flex上下固定中间滚动布局

    传统 pc 端中,子容器高度超出父容器高度,通常使用 overflow:auto 可出现滚动条拖动显示溢出的内容,而移动web开发中,由于浏览器厂商的系统不同.版本不同,导致有部分机型不支持对弹性滚动 ...

  10. 苹果公布WWDC2016时间 并做了个程序员情怀网页

    新浪手机讯 4月19日上午消息,苹果公司今日正式确定2016年全球开发者大会(WWDC)开幕时间:6月13-17日,并做了个非常有意思的代码风格页面. 网友戏称这个页面只有程序员们才能看懂,它的首页是 ...