标签:
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 19552 | Accepted: 7889 |
Description
Input
Output
Sample Input
6 5 2 4 1 7 5 0
Sample Output
Set #1 The minimum number of moves is 5.
Source
1 #include <stdio.h> 2 int main() 3 { 4 int n, cse=1, h[51]; 5 while(scanf("%d", &n), n){ 6 printf("Set #%d\n", cse++); 7 int ave=0, res=0; 8 for(int i=0; i<n; i++) { 9 scanf("%d", h+i); 10 ave+=h[i]; 11 } 12 ave/=n; 13 for(int i=0; i<n; i++) 14 if(h[i]>ave) 15 res+=h[i]-ave; 16 printf("The minimum number of moves is %d.\n\n", res); 17 } 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/BlackStorm/p/4940588.html