Follows 591.c (Total 24 lines):

/* @JUDGE_ID:4461XX 591 C */
/* A */
# include <stdio.h>
int a[50];
void main(void)
{
	int n,i,times = 0;
	while ( scanf ( "%d" , &n ) == 1 )
	{
		unsigned int total = 0 , step = 0 ;
		if ( n == 0 ) break ; times ++ ;
		printf( "Set #%d\n" , times ) ;
		for ( i = 0 ; i < n ; i++ )
		{
			scanf ( "%d" , &a[i] ) ;
			total += a[i] ;
		}
		total /= n ;
		for ( i = 0 ; i < n ; i++ )
		if ( a[i] > total ) step = step + a[i] - total ;
		printf( "The minimum number of moves is %u.\n" , step );
	}
}


Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com