UVA 591
#include<iostream> using namespace std; int main() { int n,v=1; while(cin>>n) { cin.ignore(); if(n==0)break; int i,j,a[60],sum=0; for(i=0;i<n;i++) { cin>>a[i]; cin.ignore(); sum+=a[i]; } sum=sum/n; int flag=0; for(j=0;j<n;j++) { if(a[j]>sum) flag+=a[j]-sum; } cout<<"Set #"<<v++<<endl; cout<<"The minimum number of moves is "<<flag<<"."<<endl<<endl; } return 0; }