-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB. T-primes -Codeforces Round 142 (Div. 2) .cpp
More file actions
65 lines (58 loc) · 1.55 KB
/
B. T-primes -Codeforces Round 142 (Div. 2) .cpp
File metadata and controls
65 lines (58 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ); //(will neglect the c's stdio.h property of doing inline flushing with every line of code)
//std::ios_base::sync_with_stdio(false); // (removes the interoperability that happens between C's stdio.h and iostream )
#include <iostream>
//#include<numeric>
//#include<vector>
#include<cmath>
//#include<stack>
//#include <iomanip>
//#include <vector>
#include<bits/stdc++.h>
//#include <bitset>
////#include<iomanip>
//#include <algorithm>
//#include<queue>
////#include<deque>
////#include<numeric>
//#include<set>
//#include<unordered_set>
//#include<map>
////#include<fstream>
//#include<sstream>
////#include <thread>
////#include <chrono>
//#include<cstring>
//#include<string>
//#include <unordered_map>
////#include <thread>
////#include<limits>+++
using namespace std;
int main(){
int n;
cin>>n;
for(int i =0;i<n;++i){
long long temp;
cin>>temp;
if(temp ==4)cout<<"YES\n";
else if ((temp%2)==0) cout<<"NO\n";
else{
long long res =sqrt(temp);
if((res* res) != temp || temp == 1)cout<<"NO\n";
else{
bool a=false;
if(!(res%2)){
cout<<"NO\n";
continue;
}
for(int i=3 ;i*i<=res;i+=2){
if((temp%i)==0){
a=true;
cout<<"NO\n";
break;
}
}
if(!a) cout<<"YES\n";
}
}
}
}