#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
int s[10000];
while(cin>>n)
{
if(n==0)
return 0;
int sum=0,sum1=0;
for(int i=0;i<n;i++)
{
cin>>s[i];
sum+=s[i];
}
int average=sum/n;
int m;
for(int i=0;i<n;i++)
{
m=s[i]-average;
if(m<0)
sum1+=-m;
else
sum1+=m;
}
cout<<sum1/2<<endl<<endl;
}
return 0;
}
1013——摆积木
最新推荐文章于 2023-12-29 23:03:11 发布