結果

問題 No.36 素数が嫌い!
ユーザー nCk_cvnCk_cv
提出日時 2016-02-05 13:52:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 3,732 ms
コンパイル使用メモリ 74,700 KB
実行使用メモリ 57,596 KB
最終ジャッジ日時 2023-10-21 19:16:16
合計ジャッジ時間 9,914 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
57,352 KB
testcase_01 AC 231 ms
57,512 KB
testcase_02 AC 132 ms
57,360 KB
testcase_03 AC 135 ms
55,548 KB
testcase_04 AC 137 ms
57,392 KB
testcase_05 AC 137 ms
57,028 KB
testcase_06 AC 136 ms
57,444 KB
testcase_07 AC 135 ms
57,500 KB
testcase_08 AC 136 ms
57,332 KB
testcase_09 AC 137 ms
57,444 KB
testcase_10 AC 134 ms
57,364 KB
testcase_11 AC 173 ms
57,288 KB
testcase_12 AC 247 ms
57,568 KB
testcase_13 AC 244 ms
55,532 KB
testcase_14 AC 208 ms
57,196 KB
testcase_15 AC 136 ms
57,064 KB
testcase_16 AC 134 ms
57,492 KB
testcase_17 AC 133 ms
57,452 KB
testcase_18 WA -
testcase_19 AC 181 ms
55,456 KB
testcase_20 AC 260 ms
57,552 KB
testcase_21 AC 222 ms
57,332 KB
testcase_22 AC 222 ms
57,540 KB
testcase_23 AC 188 ms
57,468 KB
testcase_24 AC 203 ms
57,596 KB
testcase_25 AC 196 ms
57,328 KB
testcase_26 AC 204 ms
57,400 KB
testcase_27 AC 231 ms
57,332 KB
testcase_28 AC 201 ms
57,368 KB
testcase_29 AC 243 ms
57,572 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() > 1 && tmp*tmp != nn) System.out.println("YES");
		else System.out.println("NO");
	}
}
0