#include<iostream> #include<algorithm> using namespace std; int n; bool prim(int x){ if(x<2)return false; for(int i=2;i<=x/i;i++){ if(x%i==0) return false; } return true; } int main(void){ cin>>n; for(int i=0,a;i<n;i++){ cin>>a; if(prim(a))cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }
原文:https://www.cnblogs.com/programyang/p/11212849.html