delete pics to save space
This commit is contained in:
28
1.3383.cpp
Normal file
28
1.3383.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include<cstdio>
|
||||
#include<cstring>
|
||||
#include<cmath>
|
||||
const int maxn=10000000;
|
||||
const int maxsize=maxn/log(maxn)*1.2;
|
||||
bool isp[maxn+5];
|
||||
int p[maxsize],cnt;
|
||||
int main()
|
||||
{
|
||||
memset(isp,true,sizeof(isp));
|
||||
for(int i=2;i<=maxn;i++)
|
||||
{
|
||||
if(isp[i]) p[cnt++]=i;
|
||||
for(int j=0;j<cnt&&i*p[j]<=maxn;j++)
|
||||
{
|
||||
isp[i*p[j]]=false;
|
||||
if(i%p[j]==0) break;
|
||||
}
|
||||
}
|
||||
int n,m,x;
|
||||
scanf("%d%d",&n,&m);
|
||||
while(m-->0)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
printf("%s\n",(x>1&&isp[x])?"Yes":"No");
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user