fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. double a[1000] = { 0 }, d, c = 0, b = 0, f = 0;
  5. cin >> d;
  6. while (d != f) {
  7. cin >> c;
  8. for (int i = 0; i < c; i++) {
  9. cin >> a[i];
  10. b += a[i];
  11. }
  12. int s = 0;
  13. for (int i = 0; i < c; i++)
  14. if (c * a[i] > b) s++;
  15. double x = s / c * 100;
  16. cout << fixed;
  17. cout.precision(3);
  18. cout << x << "%" << endl;
  19. b = 0;
  20. f++;
  21. }
  22. }
Success #stdin #stdout 0s 4464KB
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%