标签:
1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 5 int main() 6 { 7 unsigned C, N, tot_gra, aver, abo_c, gra[10010]; 8 float perc; 9 int i; 10 cin >> C; 11 while(C--) 12 { 13 cin >> N; 14 tot_gra = 0; // tot_gra: total_grade 15 for(i = 1; i <= N; i++) 16 { 17 cin >> gra[i]; 18 tot_gra += gra[i]; 19 } 20 21 aver = tot_gra / N; 22 23 abo_c = 0; 24 for(i=0; i <= N; i++) 25 if(gra[i] > aver) 26 abo_c ++; 27 28 perc = float(abo_c) / N * 100; 29 printf("%0.3f%%\n", perc); 30 } 31 return 0; 32 }
标签:
原文地址:http://www.cnblogs.com/aze-003/p/5094633.html