谢谢谢谢诶 帮忙 !!感谢

P3383 【模板】线性筛素数

emmmmmm
by BlueArc @ 2018-01-04 00:40:57


搞不懂你的思路 ```cpp #include <cstring> #include <string.h> #include <stdio.h> #include <iostream> #include <cmath> #include <math.h> #include <cctype> #include <cstdlib> #include <algorithm> using namespace std; bool prime[10000001]; void prework(int n){ memset(prime,1,sizeof(prime)); prime[1]=prime[0]=0; for (int i=2;i<=n;i++){ if(prime[i]){ for (int j=2;j<=n/i;j++){ prime[i*j]=0; } } } } int main(){ int n,m; scanf("%d %d",&n,&m); prework(n); for (int i=1;i<=m;i++){ int x; cin>>x; if (prime[x]) puts("Yes"); else puts("No"); } return 0; } ```
by Altria_Pendragon_ @ 2018-01-04 12:55:35


@[rose\_](/space/show?uid=51621) 小佬好!
by LoveMind @ 2018-01-09 12:00:33


@[Treedom](/space/show?uid=76880) **蓝名**dalao好
by Altria_Pendragon_ @ 2018-01-09 17:00:09


|