又是大水题,照着做就行了
#include <stdio.h>double readline()
{int count;scanf("%d", &count);int num[1000] = { 0 };int i = 0;for (int b = 0; b < count; b++){scanf("%d", &num[i]); i++;}double avg = 0; int sum = 0;for (int j = 0; j < i; j++){sum += num[j];}avg = sum*1.0 / i;int above = 0;for (int j = 0; j < i; j++){if (num[j]>avg)above++;}return above*1.0 / count * 100;
}int main()
{int round;scanf("%d", &round);double result[1000];for (int a = 0; a < round; a++){result[a]=readline();if(a<round-1) scanf("\n");}for (int a = 0; a < round; a++){printf("%.3lf%%\n", result[a]);}return 0;
}