1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int main() 5 { 6 int n; 7 cin>>n; 8 if(n==1) { 9 cout<<2<<endl; 10 return 0; 11 } 12 n=n-1; 13 int t=3; 14 while(t<=104730){ 15 bool flag=true; 16 for( int i=2;i<=sqrt(t);i++){ 17 if(t%i==0) flag = false; 18 continue; 19 } 20 if(flag==true) { 21 n--; 22 if(n==0){ 23 cout<<t<<endl; 24 return 0; 25 } 26 } 27 t=t+2; 28 } 29 }
本知识属于个人知识成果,如需转载,请邮件请求