結果

問題 No.36 素数が嫌い!
ユーザー GrenacheGrenache
提出日時 2015-11-03 15:46:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 824 bytes
コンパイル時間 3,827 ms
コンパイル使用メモリ 75,224 KB
実行使用メモリ 56,696 KB
最終ジャッジ日時 2023-10-11 13:24:11
合計ジャッジ時間 10,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
56,188 KB
testcase_01 AC 229 ms
56,696 KB
testcase_02 AC 122 ms
56,128 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 124 ms
56,428 KB
testcase_08 AC 122 ms
55,528 KB
testcase_09 AC 126 ms
56,144 KB
testcase_10 AC 124 ms
55,980 KB
testcase_11 AC 157 ms
39,252 KB
testcase_12 AC 232 ms
39,108 KB
testcase_13 WA -
testcase_14 AC 196 ms
39,584 KB
testcase_15 AC 121 ms
39,524 KB
testcase_16 AC 117 ms
39,092 KB
testcase_17 AC 120 ms
39,456 KB
testcase_18 AC 117 ms
39,360 KB
testcase_19 AC 167 ms
40,016 KB
testcase_20 AC 243 ms
39,892 KB
testcase_21 AC 209 ms
39,384 KB
testcase_22 AC 208 ms
39,296 KB
testcase_23 AC 171 ms
39,012 KB
testcase_24 AC 194 ms
39,848 KB
testcase_25 AC 179 ms
39,328 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class Main_yukicoder36 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

		Map<Long, Integer> hm = new HashMap<Long, Integer>();
		long tmp = n;
		for (long j = 2; j * j <= tmp; j++) {
			while (n % j == 0) {
				if (hm.containsKey(j)) {
					hm.put(j, hm.get(j) + 1);
				} else {
					hm.put(j, 1);
				}
				n /= j;
			}
		}
		if (n != 1) {
			if (hm.containsKey(n)) {
				hm.put(n, hm.get(n) + 1);
			} else {
				hm.put(n, 1);
			}
		}

		int max = 0;
		for (int e : hm.values()) {
			max = Math.max(max, e);
		}

		if (max > 1 || hm.size() > 1) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
        
        sc.close();
    }
}
0