Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:天啊,这错在哪啊

Posted by smithlp at 2007-04-28 10:02:35 on Problem 2350
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator