結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 217 ms
55,960 KB
testcase_02 AC 122 ms
55,768 KB
testcase_03 AC 121 ms
55,868 KB
testcase_04 AC 122 ms
55,920 KB
testcase_05 AC 123 ms
55,528 KB
testcase_06 AC 123 ms
55,696 KB
testcase_07 AC 122 ms
55,836 KB
testcase_08 AC 122 ms
55,912 KB
testcase_09 WA -
testcase_10 AC 123 ms
56,068 KB
testcase_11 AC 164 ms
55,692 KB
testcase_12 AC 242 ms
57,832 KB
testcase_13 AC 240 ms
56,212 KB
testcase_14 WA -
testcase_15 AC 122 ms
56,072 KB
testcase_16 AC 122 ms
55,808 KB
testcase_17 AC 124 ms
55,808 KB
testcase_18 WA -
testcase_19 AC 170 ms
56,052 KB
testcase_20 AC 245 ms
56,232 KB
testcase_21 AC 214 ms
55,884 KB
testcase_22 AC 217 ms
55,740 KB
testcase_23 AC 180 ms
55,688 KB
testcase_24 AC 189 ms
55,884 KB
testcase_25 WA -
testcase_26 AC 195 ms
55,592 KB
testcase_27 AC 222 ms
56,128 KB
testcase_28 AC 192 ms
55,936 KB
testcase_29 AC 237 ms
55,840 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