uva 591

 1 #include<stdio.h>
 2 int t = 1;
 3 
 4 int main()
 5 {
 6     int total , h[55] , n , s;
 7     while(scanf("%d" , &n)==1 && n )
 8     {
 9         int i ,ave;
10         total = 0 ;s = 0 ;
11         for(i = 0 ;i < n ;i++)
12             {scanf("%d",&h[i]) ;total+=h[i] ;}
13 
14         ave = total/n ;
15         for(i = 0 ;i < n ;i++)
16         {
17            if(ave<h[i])
18             {
19                  s += h[i]-ave;
20             }
21         }
22         printf("Set #%d\n",t);t++;
23         printf("The minimum number of moves is %d.\n" , s) ;
24         printf("\n");
25     }
26     return 0 ;
27 }

本题最难的是输出中的那个  句号 

posted @ 2013-11-14 21:59  shaughn  阅读(148)  评论(0编辑  收藏  举报