Follows 10370.c (Total 41 lines):

/* @JUDGE_ID:4461XX 10370 C */
/* A */
#include<stdio.h>
#define MAXN 1000

int n , grade[MAXN] ;
double avr ;

void input( void )
{
	int i , total=0 ;
	
	scanf( "%d" , &n ) ;
	for( i=0 ; i<n ; ++i ){
		scanf( "%d" , &grade[i] ) ;
		total += grade[i] ;
	}

	avr = (double)total/(double)n ;
}
double ratio( void )
{
	int i , count=0 ;

	for( i=0 ; i<n ; ++i )
		if( (double)grade[i]>avr ) ++count ;

	return (double)count/(double)n ;
}
int main( void )
{
	int cases ;

	scanf( "%d" , &cases ) ;
	for( ; cases ; --cases ){
		input() ;
		printf( "%.3f%c\n" , ratio()*100.0 , '%' ) ;
	}

	return 0 ;
}

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