結果

問題 No.36 素数が嫌い!
ユーザー tentententen
提出日時 2020-11-17 08:51:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 234 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 71,396 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-09-30 07:41:13
合計ジャッジ時間 7,844 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
55,988 KB
testcase_01 AC 131 ms
56,004 KB
testcase_02 AC 125 ms
53,732 KB
testcase_03 AC 123 ms
55,332 KB
testcase_04 AC 123 ms
55,948 KB
testcase_05 AC 126 ms
55,700 KB
testcase_06 AC 123 ms
55,540 KB
testcase_07 AC 125 ms
55,712 KB
testcase_08 AC 122 ms
55,904 KB
testcase_09 AC 126 ms
56,028 KB
testcase_10 AC 121 ms
56,296 KB
testcase_11 AC 160 ms
55,820 KB
testcase_12 AC 234 ms
55,908 KB
testcase_13 AC 234 ms
56,032 KB
testcase_14 AC 122 ms
55,428 KB
testcase_15 AC 122 ms
55,640 KB
testcase_16 AC 122 ms
55,336 KB
testcase_17 AC 123 ms
55,688 KB
testcase_18 AC 124 ms
55,896 KB
testcase_19 AC 136 ms
55,352 KB
testcase_20 AC 131 ms
55,836 KB
testcase_21 AC 142 ms
55,904 KB
testcase_22 AC 130 ms
56,268 KB
testcase_23 AC 127 ms
55,552 KB
testcase_24 AC 144 ms
55,820 KB
testcase_25 AC 148 ms
55,812 KB
testcase_26 AC 164 ms
55,696 KB
testcase_27 AC 127 ms
55,692 KB
testcase_28 AC 162 ms
55,948 KB
testcase_29 AC 126 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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