fork download
  1. #include <stdio.h>
  2. #pragma warning(disable:4996)
  3.  
  4. int main() {
  5. int a, b, c;
  6. int score[1000];
  7. double sum = 0;
  8. int people = 0;
  9. double average = 0;
  10. scanf("%d", &a);
  11.  
  12. for (int i = 0; i<a; i++) {
  13. scanf("%d", &c);
  14. for (int j = 0; j<c; j++) {
  15. scanf("%d", &score[j]);
  16. sum += score[j];
  17. }
  18. average = sum / (double)c;
  19. for (int j = 0; j<c; j++) {
  20. if (average < score[j]) people++;
  21. }
  22. printf("%.3lf%%", people / (double)c * 100);
  23.  
  24. sum = 0;
  25. people = 0;
  26. average = 0;
  27. }
  28. }
Success #stdin #stdout 0s 15232KB
stdin
5
5 50 50 70 80 100
7 100 95 90 80 70 60 50
3 70 90 80
3 70 90 81
9 100 99 98 97 96 95 94 93 91
stdout
40.000%57.143%33.333%66.667%55.556%