fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7.  
  8. int n;
  9. cin >> n;
  10.  
  11. long long sum = 0;
  12. int a;
  13. int arr[10000];
  14.  
  15. for (int i = 0; i < n; i++) {
  16. cin >> arr[i];
  17. sum += arr[i];
  18. }
  19.  
  20. double avg = (double)sum / n;
  21. int count = 0;
  22.  
  23. for (int i = 0; i < n; i++) {
  24. if (arr[i] > avg) count++;
  25. }
  26.  
  27. cout << count;
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5288KB
stdin
4
10 20 30 40
stdout
2