結果

問題 No.36 素数が嫌い!
ユーザー kenji_shioya
提出日時 2016-06-26 07:52:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 190 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 3,479 ms
コンパイル使用メモリ 75,824 KB
実行使用メモリ 54,360 KB
最終ジャッジ日時 2024-06-27 00:47:51
合計ジャッジ時間 8,392 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise128{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    long n = sc.nextLong();
    int count = 0;
    while(n % 2 == 0){
      n /= 2;
      count++;
    }
    for(long i = 3; i * i <= n; i += 2){
      while(n % i == 0){
        n /= i;
        count++;
      }
    }
    if(n > 1){
      count++;
    }
    if(count > 2){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
	}
}
0