标签:
1 #include <stdio.h> 2 3 int main() 4 { 5 int n, cse=1, h[51]; 6 while(scanf("%d", &n), n){ 7 printf("Set #%d\n", cse++); 8 int ave=0, res=0; 9 for(int i=0; i<n; i++) { 10 scanf("%d", h+i); 11 ave+=h[i]; 12 } 13 ave/=n; 14 for(int i=0; i<n; i++) 15 if(h[i]>ave) 16 res+=h[i]-ave; 17 printf("The minimum number of moves is %d.\n\n", res); 18 } 19 return 0; 20 }
标签:
原文地址:http://www.cnblogs.com/BlackStorm/p/4940537.html