結果

問題 No.36 素数が嫌い!
ユーザー jp_stejp_ste
提出日時 2016-03-01 21:51:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 235 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 71,804 KB
実行使用メモリ 56,380 KB
最終ジャッジ日時 2023-09-09 07:33:44
合計ジャッジ時間 7,684 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
56,148 KB
testcase_01 AC 128 ms
56,024 KB
testcase_02 AC 121 ms
56,008 KB
testcase_03 AC 120 ms
56,132 KB
testcase_04 AC 120 ms
56,356 KB
testcase_05 AC 116 ms
55,708 KB
testcase_06 AC 120 ms
55,652 KB
testcase_07 AC 121 ms
55,744 KB
testcase_08 AC 120 ms
55,536 KB
testcase_09 AC 118 ms
55,740 KB
testcase_10 AC 119 ms
55,912 KB
testcase_11 AC 160 ms
55,916 KB
testcase_12 AC 233 ms
55,692 KB
testcase_13 AC 235 ms
55,912 KB
testcase_14 AC 126 ms
55,608 KB
testcase_15 AC 124 ms
55,676 KB
testcase_16 AC 124 ms
55,980 KB
testcase_17 AC 124 ms
56,052 KB
testcase_18 AC 123 ms
55,688 KB
testcase_19 AC 132 ms
54,332 KB
testcase_20 AC 132 ms
55,688 KB
testcase_21 AC 144 ms
56,004 KB
testcase_22 AC 131 ms
55,892 KB
testcase_23 AC 126 ms
55,832 KB
testcase_24 AC 143 ms
55,596 KB
testcase_25 AC 148 ms
56,380 KB
testcase_26 AC 168 ms
55,688 KB
testcase_27 AC 130 ms
55,956 KB
testcase_28 AC 165 ms
55,944 KB
testcase_29 AC 127 ms
55,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            long N = scan.nextLong();
            
            int count = 0;
            for(int i=2; i<=Math.sqrt(N); i++) {
                while(N % i == 0) {
                    N /= i;
                    count++;
                }
            }
            if(N > 1) count++;
            
            if(count>=3) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}
0