結果

問題 No.36 素数が嫌い!
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-26 07:52:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 182 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 3,100 ms
コンパイル使用メモリ 71,900 KB
実行使用メモリ 56,628 KB
最終ジャッジ日時 2023-09-09 07:39:49
合計ジャッジ時間 8,274 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
56,396 KB
testcase_01 AC 124 ms
55,748 KB
testcase_02 AC 120 ms
55,656 KB
testcase_03 AC 121 ms
56,336 KB
testcase_04 AC 119 ms
56,132 KB
testcase_05 AC 120 ms
56,200 KB
testcase_06 AC 121 ms
55,916 KB
testcase_07 AC 120 ms
55,648 KB
testcase_08 AC 119 ms
55,740 KB
testcase_09 AC 118 ms
55,784 KB
testcase_10 AC 119 ms
56,232 KB
testcase_11 AC 142 ms
55,848 KB
testcase_12 AC 177 ms
55,388 KB
testcase_13 AC 182 ms
55,600 KB
testcase_14 AC 127 ms
55,832 KB
testcase_15 AC 120 ms
55,672 KB
testcase_16 AC 120 ms
56,424 KB
testcase_17 AC 121 ms
55,648 KB
testcase_18 AC 121 ms
55,996 KB
testcase_19 AC 127 ms
56,628 KB
testcase_20 AC 128 ms
55,560 KB
testcase_21 AC 132 ms
55,780 KB
testcase_22 AC 125 ms
56,436 KB
testcase_23 AC 123 ms
56,344 KB
testcase_24 AC 132 ms
54,192 KB
testcase_25 AC 134 ms
56,172 KB
testcase_26 AC 144 ms
56,000 KB
testcase_27 AC 124 ms
55,612 KB
testcase_28 AC 145 ms
56,124 KB
testcase_29 AC 123 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

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