結果

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

ソースコード

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);System.out.println(M);
        for(long i=3;i<=M; i+=2){
            while(N%i==0){
                c++;
                N/=i;
            }
            if(c>=3){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

0