結果

問題 No.36 素数が嫌い!
ユーザー magurogumamaguroguma
提出日時 2017-08-08 18:15:50
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 491 bytes
コンパイル時間 1,754 ms
コンパイル使用メモリ 74,136 KB
実行使用メモリ 55,900 KB
最終ジャッジ日時 2024-04-20 05:13:52
合計ジャッジ時間 5,905 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();

        int divisorCount = 0;
        for(long i=2; i<=Math.pow(N, 0.5); i++){
            if(N%i == 0){
                divisorCount++;
            }
            if(divisorCount==2){
                System.out.println("YES");
                System.exit(1);
            }
        }
        System.out.println("No");
    }
}
0