标签:name span color bsp scanf math clu bool main
#include<algorithm> #include<cstdio> #include<cstdlib> #include<iostream> #include<cmath> #include<cstring> #include<string> #include<queue> using namespace std; int pri[1000005]; bool pa[1000005]; int cnt,n; void sieve(int top){//线性筛top以内素数 for(int i=2;i<=top;i++){ if(!pa[i]) pri[++cnt]=i; for(int j=1;j<=cnt;j++){ if(pri[j]*i>top) break; pa[pri[j]*i]=1; if(i%pri[j]==0) break; } } } int main(){ scanf("%d",&n); sieve(n); return 0; }
标签:name span color bsp scanf math clu bool main
原文地址:https://www.cnblogs.com/XBird/p/13111126.html