链接
开方比乘方快,用后者 超时
1不是素数!!!
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cul(ll x)
{
//for(int i=2;i*i<=x;i++)//会超时
for(int i=2;i<=sqrt(x);i++)
{
if(x%i==0)
return 0;
}
return 1;
}
int main()
{
ll t,n;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
if(n==1)
{
printf("No\n");
continue;
}
if( cul(n) )
printf("Yes\n");
else printf("No\n");
}
}