fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <deque>
  5. #include <queue>
  6. #include <map>
  7. #include <cmath>
  8.  
  9. using namespace std;
  10. #define sd(x) scanf("%d",&x);
  11. #define sdl(x) scanf("%lld",&x);
  12. #define pr(x) printf("%d\n",x);
  13. #define prl(x) printf("%lld\n",x);
  14. long long mod=1000000007;
  15.  
  16.  
  17. long long exp(long long a,long long m)
  18. {
  19. if (m==0)return 1;
  20. if (m%2==0)return exp((a*a),m/2);
  21. else return (exp((a*a),m/2)*(a));
  22. }
  23.  
  24. int msb(long long int x)
  25. {
  26. int xy(0);
  27. for (long long int c(1),j(1);c<=x;c=c*2,j++)
  28. {
  29. if ((c&x)==c)xy=j;
  30. }
  31. return xy;
  32. }
  33.  
  34.  
  35. int main ()
  36. {
  37.  
  38. int n;
  39. sd(n);
  40. vector<int>arr;
  41. double total;
  42. for (int c(0);c<n;c++){int a;sd(a);arr.push_back(a);total+=a;}
  43. total=total/n;
  44. sort(arr.begin(),arr.end());
  45. int ans(0);
  46. for (int c(0);c<arr.size();c++)
  47. {
  48. if (total<4.5)
  49. {total=total*n-arr[c]+5;total=total/n;ans++;}
  50. else break;
  51. }
  52. cout << ans << endl;
  53.  
  54.  
  55. return 0;
  56.  
  57. }
Success #stdin #stdout 0s 4468KB
stdin
30

4 2 4 2 4 2 2 4 4 4 4 2 4 4 4 2 2 2 2 4 2 4 4 4 2 4 2 4 2 2
stdout
15