fork download
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #define ll long long
  4. bool check(ll n)
  5. {
  6. if(n<2) return false;
  7. if(n==2) return true;
  8. if(n%2==0) return false;
  9. for(ll i=3;i*i<=n;i+=2)
  10. if(n%i==0) return false;
  11. return true;
  12. }
  13. int main()
  14. {
  15. ll t;
  16. scanf("%lld",&t);
  17. while(t--)
  18. {
  19. ll a;
  20. scanf("%lld",&a);
  21. if(check(a))
  22. printf("YES\n");
  23. else
  24. printf("NO\n");
  25. }
  26. }
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
Standard output is empty