POJ 2350
1 #include<iostream> 2 #include<stdio.h> 3 #include<iomanip> 4 using namespace std; 5 int main() 6 { 7 //freopen("acm.acm","r",stdin); 8 int * score; 9 int i; 10 double sum; 11 int k; 12 int num; 13 int anum; 14 cin>>anum; 15 while(anum--) 16 { 17 cin>>num; 18 sum = 0; 19 k = 0; 20 score = new int[num]; 21 for(i = 0 ; i < num ; i++) 22 { 23 cin>>score[i]; 24 sum += score[i]; 25 } 26 sum = sum/double(num); 27 for(i = 0; i < num; i ++) 28 { 29 if(score[i]>sum) 30 k++; 31 } 32 cout<<setiosflags(ios::fixed)<<setprecision(3)<<double(k)/double(num)*100<<"%"<<endl; 33 } 34 }