#include <iostream>
#include <cstdio>
using namespace std ;
int main (){
int test,i,a[106],sum,ans,ave,c=0;
while(scanf("%d",&test)==1){
if(test==0)break;
sum=0;ans=0;c++;
for(i=1;i<=test;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
ave=sum/test;
for(i=1;i<=test;i++){
if(a[i]<ave){
ans+=(ave-a[i]);
}
}
printf("Set #%d\nThe minimum number of moves is %d.\n\n",c,ans);
}
return 0;
}
#include <cstdio>
using namespace std ;
int main (){
int test,i,a[106],sum,ans,ave,c=0;
while(scanf("%d",&test)==1){
if(test==0)break;
sum=0;ans=0;c++;
for(i=1;i<=test;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
ave=sum/test;
for(i=1;i<=test;i++){
if(a[i]<ave){
ans+=(ave-a[i]);
}
}
printf("Set #%d\nThe minimum number of moves is %d.\n\n",c,ans);
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন