結果

問題 No.36 素数が嫌い!
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-30 00:48:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 227 ms / 5,000 ms
コード長 559 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 73,888 KB
実行使用メモリ 41,424 KB
最終ジャッジ日時 2024-04-30 00:18:28
合計ジャッジ時間 7,490 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
41,084 KB
testcase_01 AC 193 ms
41,056 KB
testcase_02 AC 101 ms
40,236 KB
testcase_03 AC 112 ms
40,924 KB
testcase_04 AC 109 ms
41,068 KB
testcase_05 AC 101 ms
39,824 KB
testcase_06 AC 112 ms
40,992 KB
testcase_07 AC 112 ms
41,064 KB
testcase_08 AC 106 ms
40,132 KB
testcase_09 AC 106 ms
40,804 KB
testcase_10 AC 112 ms
41,032 KB
testcase_11 AC 147 ms
41,120 KB
testcase_12 AC 216 ms
41,260 KB
testcase_13 AC 207 ms
40,176 KB
testcase_14 AC 180 ms
41,116 KB
testcase_15 AC 108 ms
41,028 KB
testcase_16 AC 111 ms
40,828 KB
testcase_17 AC 99 ms
39,964 KB
testcase_18 AC 109 ms
40,984 KB
testcase_19 AC 143 ms
40,088 KB
testcase_20 AC 227 ms
41,424 KB
testcase_21 AC 193 ms
40,332 KB
testcase_22 AC 211 ms
41,280 KB
testcase_23 AC 173 ms
41,304 KB
testcase_24 AC 168 ms
40,728 KB
testcase_25 AC 168 ms
40,548 KB
testcase_26 AC 173 ms
41,208 KB
testcase_27 AC 212 ms
41,260 KB
testcase_28 AC 161 ms
40,044 KB
testcase_29 AC 199 ms
39,816 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