本题总分:10 分
【问题描述】
我们知道第一个质数是 2、第二个质数是 3、第三个质数是 5……请你计算 第 2019 个质数是多少?
【答案提交】
这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一 个整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。
1 //for循环暴力破解 2 //那个A:的意思是对后面的for进行标记,可以break A就是直接终止A的循环 3 // continue A就是跳过一次A的循环 4 5 public class zhishu { 6 public static void main(String[] args) { 7 int count = 0;int temp = 0; 8 A: for (int i = 2; ; i++) { 9 for (int j = 2; j <i; j++) { 10 if(i%j==0){ 11 12 continue A; 13 } 14 } 15 count++; 16 if(count==2019){ 17 System.out.println(i); 18 break; 19 } 20 } 21 } 22 23 }