标签:style blog io color sp for div log bs
#include<stdio.h> int a[2000001]; int main() { int i,j,n; for(i=2;i<=2000000;i++) { if(!a[i]) //未被标记 for(j=i+i;j<=2000000;j+=i) //素数的倍数不是素数 a[j]=1; //标记 } while(scanf("%d",&n),n) { printf("2"); for(i=3;i<=n;i++) if(!a[i]) printf(" %d",i); printf("\n"); } return 0; }
标签:style blog io color sp for div log bs
原文地址:http://www.cnblogs.com/6bing/p/4116460.html