結果

問題 No.36 素数が嫌い!
ユーザー jp_ste
提出日時 2016-03-01 21:51:50
言語 Java
(openjdk 23)
結果
AC  
実行時間 242 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 2,392 ms
コンパイル使用メモリ 75,060 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-06-27 00:42:09
合計ジャッジ時間 7,326 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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