BNU Box of Bricks
http://www.bnuoj.com/bnuoj/problem_show.php?pid=1596
#include<iostream>
#include<cstdio>
#include<algorithm> using namespace std; bool cmp(int a, int b)
{
return a<b;
} int main()
{
int n,i,k,sum,p;
int a[55];
k = 0;
while(scanf("%d",&n)&&n)
{
k++;
sum = 0;
for(i = 0; i < n; i++)
{
scanf("%d",&a[i]);
sum += a[i];
}
sum = sum/n;
sort(a,a+n,cmp);
p = 0;
for(i = 0; i < n; i++)
{
if(a[i] < sum)
{
p+=(sum-a[i]);
}
else
{
break;
}
}
printf("Set #%d\n",k);
printf("The minimum number of moves is %d.\n\n",p);
} return 0;
}
BNU Box of Bricks的更多相关文章
- HDOJ 1326. Box of Bricks 纯水题
Box of Bricks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- Box of Bricks最小移动砖块数目
Description Little Bob likes playing with his box of bricks. He puts the bricks one upon another and ...
- [POJ1477]Box of Bricks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19503 Accepted: 7871 Description Litt ...
- HDOJ(HDU) 2088 Box of Bricks(平均值)
Problem Description Little Bob likes playing with his box of bricks. He puts the bricks one upon ano ...
- HDOJ 1326 Box of Bricks(简单题)
Problem Description Little Bob likes playing with his box of bricks. He puts the bricks one upon ano ...
- 591 - Box of Bricks
Box of Bricks Little Bob likes playing with his box of bricks. He puts the bricks one upon another ...
- Box of Bricks
Box of Bricks Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total ...
- HDU 2088 Box of Bricks
http://acm.hdu.edu.cn/showproblem.php?pid=2088 Problem Description Little Bob likes playing with his ...
- HDU 2088 Box of Bricks(脑洞)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2088 Box of Bricks Time Limit: 1000/1000 MS (Java/Oth ...
随机推荐
- C++对C语言的非面向对象特性扩充(1)
我将分3篇来介绍C++相对于C在非对象特性上的扩充,今天要讲的是C++在注释,输入输出,局部变量说明的扩充,以及const修饰符与C中的#define的比较. 1.C++注释除了包括原有C的块注释/* ...
- [置顶] 关于CSDN2013博客之星的一些看法
最近一个周,最火的话题当然要数CSDN2013博客之星拉票了. 实话实说,从12月14日开始,我连续5天拉票. 通过QQ群.QQ好友.CSDN文章.给CSDN粉丝发私信等多种方式拉票,真是累死我了. ...
- 查看Oracle有哪些表或者视图
转自:http://www.2cto.com/database/201211/167577.html 1.查询当前用户下,有哪些表 Sql代码 SELECT * FROM user_tables ...
- octopress command memo
1 rake new_post rake new_post[title] # Begin a new post in source/_posts 2 rake preview ht ...
- Multiple markers at this line @Override的解决方法
Multiple markers at this line - implements java.awt.event.ActionListener.actionPerformed - The metho ...
- 循环之while
- 第四种:GCD
GCD 1> 概述 Grand Central Dispatch (GCD)是Apple开发的一种多核编程技术.主要用于优化应用程序以支持多核处理器以及其他对称多处理系统. GCD提供函数实现多 ...
- 企业级IM应该帮助员工提高绩效,避免无关的信息干扰
很多上班族一定熟悉如下的场景: 您早上上班一打开QQ,就弹出一个新闻集成窗口,随便点开看看吧,这一点不要紧,您就被一个又一个的链接带着逛下去了.等回过神来要工作的时候,发现已经在这些八卦新闻上浪费了一 ...
- C# 方法的调用
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- CentOS 6.4安装(超级详细图解教程)
链接地址:http://www.osyunwei.com/archives/5855.html CentOS 6.4安装(超级详细图解教程) 附:CentOS 6.4下载地址 32位:http://m ...