输出百分比时直接乘以100然后相除即可
#include<stdio.h>
int main(void)
{
int T, n, score[1005], count, percent;
double ave, sum;
scanf("%d", &T);
while (T--) {
sum = ave = 0.0;
count = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &score[i]);
sum += (double)score[i];
}
ave = sum / n;
for (int i = 0; i < n; i++) {
if ((double)score[i] > ave) {
count++;
}
}
printf("%.3f%%\n", (count * 100.0) / n);
}
return 0;
}