結果

問題 No.36 素数が嫌い!
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-16 05:22:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 1,787 ms
コンパイル使用メモリ 71,852 KB
実行使用メモリ 56,740 KB
最終ジャッジ日時 2023-08-17 07:19:34
合計ジャッジ時間 7,076 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,060 KB
testcase_01 AC 145 ms
56,268 KB
testcase_02 AC 114 ms
55,540 KB
testcase_03 AC 116 ms
56,048 KB
testcase_04 AC 114 ms
55,980 KB
testcase_05 AC 117 ms
55,904 KB
testcase_06 AC 117 ms
55,752 KB
testcase_07 AC 119 ms
56,268 KB
testcase_08 AC 117 ms
56,288 KB
testcase_09 AC 116 ms
56,060 KB
testcase_10 AC 116 ms
55,668 KB
testcase_11 AC 140 ms
56,112 KB
testcase_12 AC 175 ms
56,512 KB
testcase_13 AC 174 ms
56,256 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 116 ms
55,892 KB
testcase_17 AC 116 ms
55,984 KB
testcase_18 AC 115 ms
56,164 KB
testcase_19 WA -
testcase_20 AC 128 ms
56,092 KB
testcase_21 WA -
testcase_22 AC 116 ms
55,876 KB
testcase_23 AC 118 ms
56,100 KB
testcase_24 AC 134 ms
55,936 KB
testcase_25 WA -
testcase_26 AC 154 ms
55,788 KB
testcase_27 AC 165 ms
55,952 KB
testcase_28 AC 154 ms
56,184 KB
testcase_29 AC 173 ms
56,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        int c=0;
        if(N%4==0){
            if(N==4){
                System.out.println("NO");
                return;
            }else{
                System.out.println("YES");
                return;
            }
        }else if(N%2==0){
            c=1;
            N/=2;
        }
        long M = (long)Math.sqrt(N);
        for(long i=3;i<=M; i+=2){
            if(N%i==0){
                c++;
            }
            if(c>=3){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}
0