fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int i,t,button,j;
  5. long int n,count=0;
  6. long double avg,sum=0;
  7. scanf("%d",&t);
  8.  
  9. for(i=0;i<t;i++)
  10. {
  11. scanf("%ld",&n);
  12. int arr[n];
  13.  
  14. for(j=0,button=0,count=0,sum=0;j<n;j++)
  15. { scanf("%d",&arr[j]);
  16.  
  17. if(arr[j]==5)
  18. ++count;
  19. if(arr[j]<3)
  20. {
  21. button=1;
  22. break;
  23. }
  24. sum=sum+arr[j];
  25. }
  26. avg=sum/n;
  27. if(count==0||button==1||avg-4.0<0)
  28. printf("No\n");
  29. else
  30. printf("Yes\n");
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 10320KB
stdin
3
5
3 4 4 4 5
5 
4 4  5 4 4
5
4 4 5 5 2
stdout
Yes
Yes
No