#include<iostream>
#include<stdio.h>
using namespace std;
#define MAX 55
int n;int wall[MAX];
int num;
int main()
{
//freopen("in.txt","r",stdin);
num=0;
while(scanf("%d",&n))
{
num++;
if(n==0)
return 0;
int i=0;int sum=0;
for(i=0;i<n;i++)
{
scanf("%d",&wall[i]);
sum+=wall[i];
}
int av=sum/n;int result=0;
for(i=0;i<n;i++)
{
if(wall[i]<av)
{
result+=av-wall[i];
}
}
printf("Set #%d\n",num);
printf("The minimum number of moves is %d.\n\n",result);
}
return 0;
}
hdoj 1326
最新推荐文章于 2018-10-22 22:06:43 发布