Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
708 B
2
Indexable
Never
//Bai 5
#include <iostream>
#include <map>

using namespace std;
typedef long long ll;

int p[1000001];
void sieve(){
	for(int i = 0; i < 1000001; i++) p[i] = 1;
	p[0] = p[1] = 0;
	for(int i = 2; i <= 1000; i++){
		if(p[i]){
			for(int j = i*i; j <= 1000000; j+=i)
				p[j] = 0;
		}
	}
}
map<ll,int> mp;
void tnum(){
	for(int i = 2; i <= 1000000; i++){
		if(p[i])
			mp[i*i] = 1; 
	}
}

int main(){
	freopen("test.inp","r",stdin);
	freopen("test.out","w",stdout);

	sieve();
	tnum();
	int n; cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++){
		if(mp[a[i]]) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}
Leave a Comment