Follows 10057.c (Total 59 lines):

/* @JUDGE_ID:4461XX 10057 C "math" */
/* A */
#include<stdio.h>
#include<stdlib.h>


int data[1000000] , n ;
int sort_f( const void *a , const void *b )
{
	return *(int *)a - *(int *)b ;
}
void input( void ) 
{
	int i ;

	for( i=0 ; i<n ; i++ ) scanf( "%d" , &data[i] ) ;
}
int search( int poi )
{
	int i , sum ;

	for( sum=i=0 ; data[i]<=data[poi]&&i<n ; i++ )
		if( data[i]==data[poi] ) sum++ ;
	
	return sum ;
}
int dif( int poi1 , int poi2 )
{
	int i , sum ;

	for( sum=0,i=data[poi1] ; i<=data[poi2] ; i++ ) sum++ ;

	return sum ;
}
int main( void )
{
	int tmp ;

	while( scanf( "%d" , &n )==1 ){
		input() ;
		qsort( (void *)data , n , sizeof( data[0] ) , sort_f ) ;

		if( n%2 ){ /* odd */
			printf( "%d" , data[n/2+1 -1] ) ;
			printf( " %d" , search( n/2+1-1 ) ) ;
			printf( " 1\n" ) ;
		}
		else{ /* even */
			printf( "%d" , data[n/2 -1] ) ;
			tmp = search( n/2-1 ) ;
			if( data[n/2]!=data[n/2-1] ) tmp += search( n/2 ) ;
			printf( " %d" , tmp ) ;
			printf( " %d\n" , dif( n/2-1 , n/2 ) ) ;
		}
	}

	return 0 ;
}
/* @END_OF_SOURCE_CODE */

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