#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,kase=0;
while(cin>>t){
if(t==0){ break;}
int a[t],sum=0,cnt=0;
for(int i=0; i<t; i++){
cin>>a[i];
sum+=a[i];
}
for(int i=0; i<t; i++){
if(a[i]>(sum/t))cnt+=a[i]-(sum/t);
}
cout<<"Set #"<<++kase<<"\nThe minimum number of moves is "<<cnt<<".\n\n";
}
return 0;
}
using namespace std;
int main()
{
int t,kase=0;
while(cin>>t){
if(t==0){ break;}
int a[t],sum=0,cnt=0;
for(int i=0; i<t; i++){
cin>>a[i];
sum+=a[i];
}
for(int i=0; i<t; i++){
if(a[i]>(sum/t))cnt+=a[i]-(sum/t);
}
cout<<"Set #"<<++kase<<"\nThe minimum number of moves is "<<cnt<<".\n\n";
}
return 0;
}
No comments:
Post a Comment