結果

問題 No.36 素数が嫌い!
ユーザー m2543315647m2543315647
提出日時 2015-05-13 14:33:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 5,618 ms
コンパイル使用メモリ 73,048 KB
実行使用メモリ 56,072 KB
最終ジャッジ日時 2023-09-20 07:31:10
合計ジャッジ時間 10,383 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,752 KB
testcase_01 AC 168 ms
55,528 KB
testcase_02 AC 129 ms
55,812 KB
testcase_03 AC 128 ms
55,492 KB
testcase_04 AC 129 ms
55,932 KB
testcase_05 WA -
testcase_06 AC 129 ms
55,704 KB
testcase_07 AC 129 ms
55,624 KB
testcase_08 AC 129 ms
55,828 KB
testcase_09 AC 127 ms
56,056 KB
testcase_10 AC 127 ms
55,744 KB
testcase_11 AC 154 ms
55,720 KB
testcase_12 AC 191 ms
55,716 KB
testcase_13 AC 189 ms
55,736 KB
testcase_14 WA -
testcase_15 AC 128 ms
55,840 KB
testcase_16 AC 128 ms
55,708 KB
testcase_17 AC 128 ms
56,072 KB
testcase_18 AC 126 ms
55,712 KB
testcase_19 AC 127 ms
55,524 KB
testcase_20 AC 144 ms
55,548 KB
testcase_21 AC 126 ms
55,468 KB
testcase_22 AC 129 ms
55,728 KB
testcase_23 AC 129 ms
55,816 KB
testcase_24 AC 148 ms
55,924 KB
testcase_25 WA -
testcase_26 AC 182 ms
55,916 KB
testcase_27 AC 183 ms
55,712 KB
testcase_28 AC 167 ms
55,964 KB
testcase_29 AC 188 ms
55,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No36 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println(check(sc.nextLong())?"YES":"NO");
    }
    public static boolean check(Long n) {
    	int count=0;
        if (n < 30) return false;
        if (n % 2 == 0) return true;
        for (int i = 3; i <= Math.sqrt(n); i += 2){
            if (n % i == 0) count++;
        if(count>=3)return true;    
        }
        return false;
    }
}
0