-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_PRIME.cpp
More file actions
37 lines (35 loc) · 755 Bytes
/
A_PRIME.cpp
File metadata and controls
37 lines (35 loc) · 755 Bytes
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
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100000;
vector<bool> p(MAXN, true);
#define fastio \
{ \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
}
int main()
{
fastio
ll t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
p[1] = 0;
// p[2]=1;
for (ll i = 2; i * i <= n; i++)
{
if (p[i] == true)
{
for (ll j = i * i; j <= n; j += i)
p[j] = false;
}
}
if (p[n] == true)
cout << "yes\n";
else
cout << "no\n";
}
}