#include <iostream>
#include <cstdio>
using namespace std;
int main(){
float x[10000], res, avg, count, ans;
int t, n;
cin >> t;
while(t--){
cin >> n;
res = 0;count = 0;
for(int i = 1; i <= n; i++){
cin >> x[i];
res = res + x[i];
}
avg = res / n;
for(int i = 1; i <= n; i++){
if(avg < x[i])count++;
}
ans = (count / n) * 100;
printf("%.3f%%", ans);
}
return 0;
}
#include <cstdio>
using namespace std;
int main(){
float x[10000], res, avg, count, ans;
int t, n;
cin >> t;
while(t--){
cin >> n;
res = 0;count = 0;
for(int i = 1; i <= n; i++){
cin >> x[i];
res = res + x[i];
}
avg = res / n;
for(int i = 1; i <= n; i++){
if(avg < x[i])count++;
}
ans = (count / n) * 100;
printf("%.3f%%", ans);
}
return 0;
}
No comments:
Post a Comment