Problem
uva 10370 英文題目
沒什麼好說的就是算平均數
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int testcase;
while(cin >> testcase){
int length;
for(int i = 0 ; i < testcase ; i++){
cin >> length;
double sum = 0;
double *scores = new double[length];
int count = 0;
for(int j = 0 ; j < length ; j++){
cin >> scores[j];
sum = sum + scores[j];
}
double avg = sum / length;
for(int j = 0 ; j < length ; j++){
if(scores[j] > avg){
count++;
}
}
printf("%.3f%%\\n",count * 100.0 / length);
}
}
}