結果

問題 No.36 素数が嫌い!
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-15 00:45:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 2,745 ms
コンパイル使用メモリ 72,140 KB
実行使用メモリ 57,848 KB
最終ジャッジ日時 2023-08-24 23:57:11
合計ジャッジ時間 8,196 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 212 ms
56,088 KB
testcase_02 AC 118 ms
56,312 KB
testcase_03 AC 116 ms
55,768 KB
testcase_04 AC 118 ms
56,020 KB
testcase_05 AC 118 ms
57,848 KB
testcase_06 AC 122 ms
55,736 KB
testcase_07 AC 119 ms
55,740 KB
testcase_08 AC 119 ms
56,288 KB
testcase_09 WA -
testcase_10 AC 119 ms
55,808 KB
testcase_11 AC 159 ms
55,840 KB
testcase_12 AC 236 ms
56,328 KB
testcase_13 AC 233 ms
55,948 KB
testcase_14 WA -
testcase_15 AC 118 ms
56,008 KB
testcase_16 AC 119 ms
56,004 KB
testcase_17 AC 117 ms
55,916 KB
testcase_18 WA -
testcase_19 AC 166 ms
56,020 KB
testcase_20 AC 238 ms
55,528 KB
testcase_21 AC 210 ms
56,004 KB
testcase_22 AC 211 ms
55,868 KB
testcase_23 AC 178 ms
55,772 KB
testcase_24 AC 183 ms
56,080 KB
testcase_25 WA -
testcase_26 AC 189 ms
55,832 KB
testcase_27 AC 223 ms
55,740 KB
testcase_28 AC 194 ms
55,632 KB
testcase_29 AC 236 ms
55,724 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++) {
			boolean b = false;
			while (n%i==0) {
				n /= i;
				b = true;
			}
			if (b==true) {total++;}
		}
		return total;
	}
}
0