結果

問題 No.36 素数が嫌い!
ユーザー nCk_cvnCk_cv
提出日時 2016-02-05 14:01:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 239 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 72,796 KB
実行使用メモリ 57,980 KB
最終ジャッジ日時 2023-09-09 07:31:41
合計ジャッジ時間 8,450 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
57,444 KB
testcase_01 AC 216 ms
56,088 KB
testcase_02 AC 121 ms
56,224 KB
testcase_03 AC 122 ms
55,796 KB
testcase_04 AC 122 ms
56,252 KB
testcase_05 AC 121 ms
55,852 KB
testcase_06 AC 122 ms
56,092 KB
testcase_07 AC 123 ms
56,328 KB
testcase_08 AC 120 ms
56,088 KB
testcase_09 AC 123 ms
55,984 KB
testcase_10 AC 121 ms
55,668 KB
testcase_11 AC 161 ms
55,848 KB
testcase_12 AC 233 ms
56,196 KB
testcase_13 AC 233 ms
55,504 KB
testcase_14 AC 193 ms
55,724 KB
testcase_15 AC 124 ms
55,884 KB
testcase_16 AC 121 ms
55,748 KB
testcase_17 AC 123 ms
55,856 KB
testcase_18 AC 124 ms
55,600 KB
testcase_19 AC 169 ms
55,744 KB
testcase_20 AC 239 ms
55,792 KB
testcase_21 AC 210 ms
56,048 KB
testcase_22 AC 211 ms
55,868 KB
testcase_23 AC 176 ms
55,864 KB
testcase_24 AC 187 ms
55,820 KB
testcase_25 AC 181 ms
57,980 KB
testcase_26 AC 191 ms
55,964 KB
testcase_27 AC 216 ms
55,976 KB
testcase_28 AC 188 ms
55,820 KB
testcase_29 AC 227 ms
56,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long nn = n;
		ArrayList<Integer> list = new ArrayList<Integer>();
		long tmp = (long)Math.sqrt(n);
		for(int i = 2; i <= tmp; i++) {
			while(n % i == 0) {
				list.add(i);
				n /= i;
			}
		}
		if(list.size() > 2 || list.size() == 2 && n != 1) System.out.println("YES");
		else System.out.println("NO");
	}
}
0