結果

問題 No.36 素数が嫌い!
ユーザー kohaku_kohaku
提出日時 2016-11-16 05:22:13
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 2,063 ms
コンパイル使用メモリ 74,524 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2024-11-26 02:08:06
合計ジャッジ時間 6,628 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 22 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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