結果

問題 No.36 素数が嫌い!
ユーザー tsunabittsunabit
提出日時 2019-09-05 10:37:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 234 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 3,571 ms
コンパイル使用メモリ 72,588 KB
実行使用メモリ 56,428 KB
最終ジャッジ日時 2023-08-30 23:25:12
合計ジャッジ時間 8,827 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
55,736 KB
testcase_01 AC 130 ms
56,056 KB
testcase_02 AC 116 ms
55,472 KB
testcase_03 AC 123 ms
55,740 KB
testcase_04 AC 122 ms
55,532 KB
testcase_05 AC 122 ms
55,612 KB
testcase_06 AC 123 ms
55,804 KB
testcase_07 AC 124 ms
55,684 KB
testcase_08 AC 123 ms
55,872 KB
testcase_09 AC 123 ms
55,812 KB
testcase_10 AC 123 ms
56,036 KB
testcase_11 AC 162 ms
56,024 KB
testcase_12 AC 233 ms
55,684 KB
testcase_13 AC 234 ms
56,172 KB
testcase_14 AC 122 ms
55,708 KB
testcase_15 AC 120 ms
55,940 KB
testcase_16 AC 120 ms
56,428 KB
testcase_17 AC 120 ms
56,200 KB
testcase_18 AC 120 ms
55,768 KB
testcase_19 AC 129 ms
55,476 KB
testcase_20 AC 127 ms
55,760 KB
testcase_21 AC 145 ms
55,532 KB
testcase_22 AC 129 ms
55,860 KB
testcase_23 AC 127 ms
56,024 KB
testcase_24 AC 143 ms
56,084 KB
testcase_25 AC 147 ms
56,068 KB
testcase_26 AC 165 ms
55,964 KB
testcase_27 AC 129 ms
55,784 KB
testcase_28 AC 163 ms
56,244 KB
testcase_29 AC 125 ms
55,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No36 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int c = 0;
		for(long i = 2; i < Math.sqrt(n); i++) {
			while(n % i == 0) {
				n /= i;
				c++;
			}
		}
		if(n != 1) c++;
		if(c > 2) System.out.println("YES");
		else System.out.println("NO");
		
    }
}
0