結果

問題 No.36 素数が嫌い!
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-15 00:49:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 236 ms / 5,000 ms
コード長 426 bytes
コンパイル時間 2,142 ms
コンパイル使用メモリ 71,488 KB
実行使用メモリ 56,552 KB
最終ジャッジ日時 2023-09-09 08:11:32
合計ジャッジ時間 7,870 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
55,628 KB
testcase_01 AC 209 ms
55,844 KB
testcase_02 AC 112 ms
55,620 KB
testcase_03 AC 111 ms
55,568 KB
testcase_04 AC 111 ms
55,944 KB
testcase_05 AC 113 ms
55,716 KB
testcase_06 AC 114 ms
55,684 KB
testcase_07 AC 114 ms
56,048 KB
testcase_08 AC 113 ms
55,776 KB
testcase_09 AC 114 ms
56,060 KB
testcase_10 AC 117 ms
56,208 KB
testcase_11 AC 155 ms
56,092 KB
testcase_12 AC 229 ms
53,920 KB
testcase_13 AC 231 ms
56,064 KB
testcase_14 AC 186 ms
55,608 KB
testcase_15 AC 113 ms
56,200 KB
testcase_16 AC 111 ms
56,472 KB
testcase_17 AC 111 ms
55,728 KB
testcase_18 AC 112 ms
55,536 KB
testcase_19 AC 160 ms
56,068 KB
testcase_20 AC 236 ms
55,788 KB
testcase_21 AC 203 ms
56,176 KB
testcase_22 AC 207 ms
56,012 KB
testcase_23 AC 172 ms
56,552 KB
testcase_24 AC 177 ms
55,888 KB
testcase_25 AC 174 ms
56,128 KB
testcase_26 AC 183 ms
55,420 KB
testcase_27 AC 211 ms
55,788 KB
testcase_28 AC 182 ms
55,412 KB
testcase_29 AC 225 ms
55,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		long n = sc.nextLong();
		System.out.println(PrimeFact(n)>=2?"YES":"NO");
	}
	
	static int PrimeFact (long n) {
		double sqrt = Math.sqrt(n);
		int total = 0;
		for (int i=2; i<sqrt; i++) {
			int num = 0;
			while (n%i==0) {
				n /= i;
				num++;
			}
			total += num;
		}
		return total;
	}
}
0