朱色虫居
Pages
Home
Featured Posts
2006/09/17
591-Box of Bricks
/*
"Box of Bricks"
Level:1.5
Date:2006/9/16
*/
#include
main(){
int n=0,i=0,sum=0,set=0,av=0,count=0;
int height[50]={0};
while(scanf("%d",&n)==1){
if(n==0)
break;
for(i=0;i < n;i++){ scanf("%d",&height[i]); sum+=height[i]; } av = sum /n; for(i=0;i < n;i++){ if(height[i] < av) count += av-height[i]; } printf("Set #%d\n",++set); printf("The minimum number of moves is %d.\n",count); count = sum = 0; printf("\n"); //key point between P.E and AC. } }
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment