fork download
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. //bool prime()
  5.  
  6.  
  7.  
  8. using namespace std;
  9. int main()
  10. {int n;
  11. cin >> n;
  12. long long a[100005];
  13. for (int i = 0; i < n; i++)
  14. cin >> a[i];
  15. int c = 0 , sq;
  16. float x;
  17. for (int i = 0; i < n; i++)
  18. {
  19. x = sqrt(a[i]);
  20. sq = x;
  21.  
  22. for (int j = 2; j <=(sq/j); j++)
  23. {
  24. if (sq % j == 0) {
  25. c++;
  26. break;
  27.  
  28. }
  29. }
  30. if (c == 0 && x==sq)
  31. cout << "YES";
  32. else
  33. cout << "NO";
  34. c = 0;
  35. cout << "\n";
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0.01s 5444KB
stdin
Standard input is empty
stdout
Standard output is empty