結果

問題 No.36 素数が嫌い!
ユーザー YamaKasaYamaKasa
提出日時 2018-06-15 01:53:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 2,142 ms
コンパイル使用メモリ 72,536 KB
実行使用メモリ 57,884 KB
最終ジャッジ日時 2023-09-13 04:28:37
合計ジャッジ時間 8,565 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 215 ms
55,888 KB
testcase_02 AC 123 ms
55,892 KB
testcase_03 AC 124 ms
56,244 KB
testcase_04 AC 124 ms
55,876 KB
testcase_05 AC 125 ms
55,984 KB
testcase_06 AC 128 ms
55,984 KB
testcase_07 AC 124 ms
55,852 KB
testcase_08 AC 125 ms
55,768 KB
testcase_09 AC 125 ms
55,956 KB
testcase_10 AC 125 ms
56,280 KB
testcase_11 AC 161 ms
55,596 KB
testcase_12 AC 232 ms
55,692 KB
testcase_13 AC 232 ms
55,716 KB
testcase_14 WA -
testcase_15 AC 126 ms
56,076 KB
testcase_16 AC 127 ms
55,748 KB
testcase_17 AC 128 ms
55,924 KB
testcase_18 AC 125 ms
55,680 KB
testcase_19 AC 172 ms
56,124 KB
testcase_20 AC 238 ms
56,088 KB
testcase_21 AC 208 ms
55,924 KB
testcase_22 AC 211 ms
55,664 KB
testcase_23 AC 179 ms
55,720 KB
testcase_24 AC 188 ms
55,664 KB
testcase_25 WA -
testcase_26 AC 193 ms
55,788 KB
testcase_27 AC 221 ms
55,940 KB
testcase_28 AC 191 ms
55,488 KB
testcase_29 AC 226 ms
55,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		scan.close();
		if(N < 7) {
			System.out.println("NO");
		}else {
			if(numPrime(N) >= 3) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}

	}
	public static int numPrime(long n) {
		int cnt = 0;
		for(int i = 2; i <= (int)Math.sqrt(n); i++){
			if(n % i == 0) {
				cnt ++;
			}
		}
		return cnt;
	}
}
0