結果

問題 No.36 素数が嫌い!
ユーザー htensaihtensai
提出日時 2019-12-18 09:05:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 663 bytes
コンパイル時間 2,597 ms
コンパイル使用メモリ 71,656 KB
実行使用メモリ 51,240 KB
最終ジャッジ日時 2023-09-19 08:53:35
合計ジャッジ時間 5,883 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,292 KB
testcase_01 AC 52 ms
50,448 KB
testcase_02 AC 44 ms
49,532 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 46 ms
49,284 KB
testcase_08 AC 44 ms
49,044 KB
testcase_09 AC 44 ms
49,092 KB
testcase_10 AC 45 ms
49,300 KB
testcase_11 AC 89 ms
49,720 KB
testcase_12 AC 166 ms
50,224 KB
testcase_13 WA -
testcase_14 AC 48 ms
49,288 KB
testcase_15 AC 47 ms
49,812 KB
testcase_16 AC 46 ms
49,288 KB
testcase_17 AC 46 ms
49,148 KB
testcase_18 AC 45 ms
49,204 KB
testcase_19 AC 45 ms
49,300 KB
testcase_20 AC 59 ms
49,620 KB
testcase_21 AC 46 ms
49,796 KB
testcase_22 AC 46 ms
49,228 KB
testcase_23 AC 46 ms
49,264 KB
testcase_24 AC 70 ms
49,640 KB
testcase_25 AC 45 ms
49,276 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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 (x != 1 && x != n) {
            count++;
        }
        if (count >= 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0