結果

問題 No.36 素数が嫌い!
ユーザー YamaKasaYamaKasa
提出日時 2018-06-15 02:02:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 71,680 KB
実行使用メモリ 58,256 KB
最終ジャッジ日時 2023-09-13 04:28:46
合計ジャッジ時間 8,503 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
55,736 KB
testcase_01 AC 212 ms
55,756 KB
testcase_02 AC 123 ms
55,980 KB
testcase_03 AC 124 ms
55,744 KB
testcase_04 AC 125 ms
56,028 KB
testcase_05 AC 124 ms
56,040 KB
testcase_06 AC 126 ms
56,092 KB
testcase_07 AC 124 ms
55,792 KB
testcase_08 AC 127 ms
55,976 KB
testcase_09 AC 125 ms
55,608 KB
testcase_10 AC 122 ms
55,688 KB
testcase_11 AC 159 ms
55,832 KB
testcase_12 AC 231 ms
56,000 KB
testcase_13 WA -
testcase_14 AC 192 ms
56,236 KB
testcase_15 AC 129 ms
56,040 KB
testcase_16 AC 121 ms
55,796 KB
testcase_17 AC 122 ms
55,664 KB
testcase_18 AC 122 ms
55,844 KB
testcase_19 AC 166 ms
55,780 KB
testcase_20 AC 234 ms
56,264 KB
testcase_21 AC 207 ms
55,780 KB
testcase_22 AC 210 ms
55,896 KB
testcase_23 AC 177 ms
56,112 KB
testcase_24 AC 185 ms
57,828 KB
testcase_25 AC 182 ms
58,256 KB
testcase_26 AC 192 ms
55,452 KB
testcase_27 AC 216 ms
55,696 KB
testcase_28 AC 189 ms
55,868 KB
testcase_29 AC 230 ms
55,756 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) >= 2) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}

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

		return cnt;
	}
}
0