有3个点RE掉了,求Java大佬解释一下,在线等

P1579 哥德巴赫猜想(升级版)

qi_f @ 2018-02-07 20:25:33

import java.util.Scanner;

public class Main { public static boolean isPrime(int n){ for (int i = 2; i <= Math.sqrt(n)+1; i++) { if(n%i==0) return false; } return true; }

public static void main(String args[]){
    Scanner sr = new Scanner(System.in);
    int x=sr.nextInt();
    for (int i = 2; i <= 19995; i++) {
        if(!isPrime(i)) continue;
        for (int j = 2; j <= 19995; j++) {
            if(!isPrime(j)) continue;
            for (int k = 2; k <= 19995; k++) {  
                if(!isPrime(k)) continue;
                if(i+j+k==x) {
                    System.out.println(i+" "+j+" "+k);
                    return;
                }
            }
        }
    }
}

}


by 丶弗鞥先生 @ 2018-04-21 19:01:14

爆掉了不用看,运算量太大了兄弟


|