来源:http://my.oschina.net/dianpaopao/blog/83844#include<stdio.h>
#include<stdlib.h>
#define NMAX 10000000
#define SQRN 10000
int main()
{ int n; scanf("%d",&n); static char a[NMAX]; unsigned long k,i; for(k=2;k<=SQRN;k++) if(!a[k]) for(i=2*k;i<n;i+=k) a[i... Read More
来源:http://my.oschina.net/dianpaopao/blog/83844#include<stdio.h>#include<stdlib.h>#define NMAX 10000000#define SQRN 10000int main(){ int n; scanf("%d",&n); static char a[NMAX]; unsigned long k,i; for(k=2;k<=SQRN;k++) if(!a[k]) for(i=2*k;i<n;i+=k) a[i]=1;... Read More