結果

問題 No.36 素数が嫌い!
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-15 00:46:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 5,414 ms
コンパイル使用メモリ 71,552 KB
実行使用メモリ 58,068 KB
最終ジャッジ日時 2023-08-24 23:57:59
合計ジャッジ時間 10,445 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
56,040 KB
testcase_01 AC 220 ms
55,956 KB
testcase_02 AC 126 ms
55,680 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 128 ms
55,404 KB
testcase_08 AC 126 ms
55,708 KB
testcase_09 AC 127 ms
55,904 KB
testcase_10 AC 126 ms
55,772 KB
testcase_11 AC 167 ms
55,400 KB
testcase_12 AC 243 ms
55,772 KB
testcase_13 WA -
testcase_14 AC 201 ms
55,948 KB
testcase_15 AC 126 ms
55,644 KB
testcase_16 AC 126 ms
55,892 KB
testcase_17 AC 129 ms
55,648 KB
testcase_18 AC 127 ms
55,392 KB
testcase_19 AC 174 ms
55,388 KB
testcase_20 AC 247 ms
55,624 KB
testcase_21 AC 217 ms
55,680 KB
testcase_22 AC 218 ms
55,736 KB
testcase_23 AC 182 ms
55,624 KB
testcase_24 AC 192 ms
55,932 KB
testcase_25 AC 187 ms
55,840 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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)>=1?"YES":"NO");
	}
	
	static int PrimeFact (long n) {
		double sqrt = Math.sqrt(n);
		int total = 0;
		for (int i=2; i<=sqrt; i++) {
			boolean b = false;
			while (n%i==0) {
				n /= i;
				b = true;
			}
			if (b==true) {total++;}
		}
		return total;
	}
}
0