#include <iostream>
#include <cstdio>
#define end if(t == 0)break;
using namespace std;
int main(){
int t, n[50], i, e = 0;
int sum = 0, avg, real;
while(scanf("%d", &t) == 1){
end;
sum = 0;
real = 0;
for(i = 0; i < t; i++){
scanf("%d", &n[i]);
sum = sum + n[i];
}
avg = sum / t;
for(i = 0; i < t; i++){
if(n[i] > avg)
real = real + (n[i] - avg);
}
e++;
printf("Set #%d\nThe minimum number of moves is %d.\n", e, real);
printf("\n");
}
return 0;
}
#include <cstdio>
#define end if(t == 0)break;
using namespace std;
int main(){
int t, n[50], i, e = 0;
int sum = 0, avg, real;
while(scanf("%d", &t) == 1){
end;
sum = 0;
real = 0;
for(i = 0; i < t; i++){
scanf("%d", &n[i]);
sum = sum + n[i];
}
avg = sum / t;
for(i = 0; i < t; i++){
if(n[i] > avg)
real = real + (n[i] - avg);
}
e++;
printf("Set #%d\nThe minimum number of moves is %d.\n", e, real);
printf("\n");
}
return 0;
}
No comments:
Post a Comment