結果

問題 No.36 素数が嫌い!
ユーザー htensaihtensai
提出日時 2019-12-18 09:08:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 2,208 ms
コンパイル使用メモリ 72,100 KB
実行使用メモリ 50,156 KB
最終ジャッジ日時 2023-09-19 08:57:28
合計ジャッジ時間 5,510 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,088 KB
testcase_01 AC 55 ms
49,824 KB
testcase_02 AC 45 ms
47,528 KB
testcase_03 AC 44 ms
49,116 KB
testcase_04 WA -
testcase_05 AC 45 ms
49,012 KB
testcase_06 AC 46 ms
49,016 KB
testcase_07 AC 47 ms
49,160 KB
testcase_08 AC 45 ms
49,648 KB
testcase_09 AC 45 ms
49,020 KB
testcase_10 AC 45 ms
49,028 KB
testcase_11 AC 89 ms
49,652 KB
testcase_12 AC 165 ms
49,784 KB
testcase_13 WA -
testcase_14 AC 46 ms
49,004 KB
testcase_15 AC 45 ms
48,980 KB
testcase_16 AC 45 ms
49,120 KB
testcase_17 AC 44 ms
49,280 KB
testcase_18 AC 44 ms
48,932 KB
testcase_19 AC 45 ms
49,000 KB
testcase_20 AC 55 ms
50,156 KB
testcase_21 AC 44 ms
48,964 KB
testcase_22 AC 44 ms
49,220 KB
testcase_23 AC 44 ms
49,492 KB
testcase_24 AC 69 ms
50,076 KB
testcase_25 AC 45 ms
48,832 KB
testcase_26 AC 92 ms
49,788 KB
testcase_27 AC 54 ms
49,872 KB
testcase_28 AC 91 ms
49,600 KB
testcase_29 AC 48 ms
48,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        long n = Long.parseLong(br.readLine());
        long x = n;
        int count = 0;
        for (long i = 2; i <= Math.sqrt(x) && count < 2; i++) {
            while(x % i == 0) {
                count++;
                x /= i;
            }
        }
        if (count >= 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0