题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1326
#include <stdio.h>
int main()
{
int height[52],n,sum,avg,i,cases=1;
while(scanf("%d",&n)&&n)
{
sum=0;
for(i=0;i<n;++i)
{
scanf("%d",&height[i]);
sum+=height[i];
}
avg=sum/n;
sum=0;
for(i=0;i<n;++i)
{
if(height[i]>avg)
sum+=height[i]-avg;
}
printf("Set #%d\n",cases++);
printf("The minimum number of moves is %d.\n\n",sum);
}
return 0;
}