| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:天啊,这错在哪啊In Reply To:天啊,这错在哪啊 Posted by:maijunsheng at 2006-09-28 23:42:25 #include <stdio.h>
int main() {
int n , i , j , m , sum , temp , count , a[1000] ;
double b[1000] ;
scanf( "%d" , &n ) ;
for( i = 0 ; i < n ; ++ i )
{
scanf( "%d" , &m ) ;
sum = 0 ;
for( j = 0 ; j < m ; ++ j )
scanf( "%d" , &a[j] ) ;
for( j = 0 ; j < m ; ++ j )
sum += a[j] ;
temp = sum / m ;
count = 0 ;
for( j = 0 ; j < m ; ++ j )
if( a[j] > temp ) count ++ ;
b[i] = (double)count / m * 100 ;
}
for( i = 0 ; i < n ; ++ i )
printf( "%.3lf%%\n" , b[i] ) ;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator