Advertisement
sivan_iut

Untitled

May 2nd, 2020
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. ///HELLO THERE~!
  2. ///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)
  3.  
  4. #include <bits/stdc++.h>
  5.  
  6. #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  7. #define read freopen("blue.txt","r",stdin);
  8. #define write freopen("red.txt","w",stdout);
  9.  
  10.  
  11. typedef long long ll;
  12.  
  13. using namespace std;
  14.  
  15. vector<bool> flag(100000, true);
  16.  
  17. void sieve()
  18. {
  19.     flag[0] = false;
  20.     flag[1] = false;
  21.     for(long long  i = 2; i < 100000; i++)
  22.         {
  23.         if(flag[i])
  24.         {
  25.         for(long long  j = 2; i*j < 100000; j++)
  26.         flag[i*j] = false;
  27.         }
  28.         }
  29.  
  30.  
  31. }
  32.  
  33.  
  34. int  main()
  35. {
  36.     long long  t;
  37.     cin>>t;
  38.     while(t--)
  39.     {
  40.         long long  n;
  41.         cin>>n;
  42.         sieve();
  43.         if(int(sqrt(n))==sqrt(n) && flag[sqrt(n)])
  44.             cout<<"YES"<<endl;
  45.         else
  46.             cout<<"NO"<<endl;
  47.     }
  48.  
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement