結果

問題 No.36 素数が嫌い!
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-30 00:48:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 246 ms / 5,000 ms
コード長 559 bytes
コンパイル時間 2,164 ms
コンパイル使用メモリ 72,316 KB
実行使用メモリ 56,340 KB
最終ジャッジ日時 2023-08-12 10:01:53
合計ジャッジ時間 8,660 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
55,796 KB
testcase_01 AC 222 ms
55,808 KB
testcase_02 AC 129 ms
55,896 KB
testcase_03 AC 127 ms
55,732 KB
testcase_04 AC 128 ms
56,340 KB
testcase_05 AC 129 ms
55,800 KB
testcase_06 AC 131 ms
55,668 KB
testcase_07 AC 133 ms
55,516 KB
testcase_08 AC 130 ms
55,892 KB
testcase_09 AC 126 ms
55,828 KB
testcase_10 AC 126 ms
55,988 KB
testcase_11 AC 165 ms
55,772 KB
testcase_12 AC 239 ms
55,560 KB
testcase_13 AC 237 ms
55,932 KB
testcase_14 AC 196 ms
55,736 KB
testcase_15 AC 124 ms
55,808 KB
testcase_16 AC 125 ms
56,052 KB
testcase_17 AC 127 ms
55,488 KB
testcase_18 AC 131 ms
55,680 KB
testcase_19 AC 173 ms
55,816 KB
testcase_20 AC 246 ms
55,788 KB
testcase_21 AC 215 ms
53,740 KB
testcase_22 AC 217 ms
55,792 KB
testcase_23 AC 185 ms
55,516 KB
testcase_24 AC 193 ms
55,672 KB
testcase_25 AC 188 ms
55,764 KB
testcase_26 AC 195 ms
55,752 KB
testcase_27 AC 222 ms
55,864 KB
testcase_28 AC 195 ms
55,804 KB
testcase_29 AC 237 ms
55,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		num_prime(n);
		if (res >= 3) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	static int res = 0;

	private static void num_prime(long n) {
		
		for (int i = 2; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				res++;
				if (n / i % i == 0) {
					res++;
					if (n / i / i % i == 0) {
						res++;
					}
				}
			}
		}
	}
}
0