Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///HELLO THERE~!
- ///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)
- #include <bits/stdc++.h>
- #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- #define read freopen("blue.txt","r",stdin);
- #define write freopen("red.txt","w",stdout);
- typedef long long ll;
- using namespace std;
- vector<bool> flag(100000, true);
- void sieve()
- {
- flag[0] = false;
- flag[1] = false;
- for(long long i = 2; i < 100000; i++)
- {
- if(flag[i])
- {
- for(long long j = 2; i*j < 100000; j++)
- flag[i*j] = false;
- }
- }
- }
- int main()
- {
- long long t;
- cin>>t;
- while(t--)
- {
- long long n;
- cin>>n;
- sieve();
- if(int(sqrt(n))==sqrt(n) && flag[sqrt(n)])
- cout<<"YES"<<endl;
- else
- cout<<"NO"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement