题解 | #素数判断#
素数判断
https://ac.nowcoder.com/acm/problem/22200
#include<bits/stdc++.h>
using namespace std;
int main(){
int t,n;
cin>>t;
while(t--){
cin>>n;
bool prime=true;
for(int i=2;i*i<=n;i++){
if(n%i==0){
prime=false;
break;
}
}
if(prime&&n!=1) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}