fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define endl '\n'
  5. typedef long long ll;
  6.  
  7. short A[100001];
  8. int N,T;
  9. long double GPA(0.0);
  10. int main(){
  11. std::ios_base::sync_with_stdio(false);
  12. cin.tie(NULL);
  13. cin >> T;
  14. while(T--){
  15. bool fail_flag = false;
  16. bool top_flag = false;
  17. cin >> N;
  18. GPA = 0.0;
  19.  
  20. for(int i=1;i<=N;++i) cin >> A[i];
  21. sort(A+1,A+N+1);
  22. for(int i=1;i<=N;++i){
  23. GPA+=( (double)A[i]/(double)N );
  24. if(A[i]==5) top_flag = true;
  25. if(A[i]==2) { fail_flag = true; break; }
  26. }
  27. if( GPA>=4.0 && top_flag && !fail_flag)
  28. cout << "Yes" << endl;
  29. else cout << "No" << endl;
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0s 3656KB
stdin
Standard input is empty
stdout
Standard output is empty