标签:amp std log problem nbsp show turn scanf 输入
输入一个正整数n,求第n小的质数。
10
29
代碼實現:
1 #include<cstdio> 2 int n,a,s[130030]; 3 bool v[130030]; 4 int main(){ 5 for(int i=2;i<=110000;i++){ 6 if(!v[i]){ 7 a=2*i;s[++s[0]]=i; 8 while(a<=110000){v[a]=1;a+=i;} 9 } 10 } 11 scanf("%d",&n); 12 printf("%d\n",s[n]); 13 return 0; 14 }
。。。
标签:amp std log problem nbsp show turn scanf 输入
原文地址:http://www.cnblogs.com/J-william/p/6156431.html