1 package a小米;
 2 
 3 import java.util.Scanner;
 4 
 5 public class prime {
 6     public static boolean isPrime(int n){
 7         for(int i=2;i<=Math.sqrt(n);i++)
 8         {
 9             if(n%i==0){
10                 return false;        
11             }
12         }
13         return true;
14     }
15 
16     public static void main(String[] args) {
17         
18         Scanner in=new Scanner(System.in);
19         while(in.hasNext()){
20             int n=in.nextInt();
21             int count=0;
22             int i=0;
23             for( i=2;i<=1000;i++){
24                 if(isPrime(i)){
25                     count++;
26                 }
27           if(count==n) break;
28             }
29             System.out.println(i);
30 
31         }
32     }
33 
34 }

 

相关文章:

  • 2022-01-07
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
  • 2021-09-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2021-06-17
  • 2021-08-12
  • 2021-06-22
相关资源
相似解决方案