ZOJ1251

 

 

//2514378 2011-04-28 13:56:30 Presentation Error 1251 C 0 160 ylwh! //2514379 2011-04-28 13:57:16 Accepted 1251 C 0 160 ylwh! #include <stdio.h> int main(void) { int n, i, sum, average, ans, ncases=0; int h[51]; while(scanf("%d", &n) && n!=0) { sum = ans = 0; ncases++; for(i=0; i<n; i++) { scanf("%d", &h[i]); sum += h[i]; } average = sum/n; for(i=0; i<n; i++) { if(h[i]>average) { ans += h[i]-average; } } printf("Set #%d/nThe minimum number of moves is %d./n/n", ncases, ans); } return 0; }

你可能感兴趣的:(c)