結果

問題 No.36 素数が嫌い!
ユーザー takeya_okinotakeya_okino
提出日時 2019-08-24 23:55:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 222 ms / 5,000 ms
コード長 654 bytes
コンパイル時間 2,331 ms
コンパイル使用メモリ 74,304 KB
実行使用メモリ 41,168 KB
最終ジャッジ日時 2024-04-22 15:47:37
合計ジャッジ時間 6,610 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
40,004 KB
testcase_01 AC 121 ms
41,152 KB
testcase_02 AC 117 ms
41,168 KB
testcase_03 AC 112 ms
40,464 KB
testcase_04 AC 101 ms
40,084 KB
testcase_05 AC 108 ms
40,748 KB
testcase_06 AC 119 ms
40,956 KB
testcase_07 AC 116 ms
41,056 KB
testcase_08 AC 111 ms
40,928 KB
testcase_09 AC 104 ms
40,084 KB
testcase_10 AC 104 ms
39,924 KB
testcase_11 AC 148 ms
40,500 KB
testcase_12 AC 217 ms
40,812 KB
testcase_13 AC 222 ms
41,148 KB
testcase_14 AC 101 ms
40,044 KB
testcase_15 AC 113 ms
40,940 KB
testcase_16 AC 113 ms
40,052 KB
testcase_17 AC 110 ms
41,120 KB
testcase_18 AC 102 ms
39,836 KB
testcase_19 AC 107 ms
40,900 KB
testcase_20 AC 115 ms
40,980 KB
testcase_21 AC 110 ms
40,248 KB
testcase_22 AC 108 ms
39,980 KB
testcase_23 AC 101 ms
39,996 KB
testcase_24 AC 122 ms
39,900 KB
testcase_25 AC 114 ms
40,052 KB
testcase_26 AC 149 ms
40,848 KB
testcase_27 AC 108 ms
39,996 KB
testcase_28 AC 146 ms
40,380 KB
testcase_29 AC 119 ms
40,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long p = 0;
    long s = 0;
    long t = 0;
    for(long i = 2; (i * i) <= n; i++) {
      if((n % i) == 0) {
        p += 2;
        s = i;
        t = n / i;
        break;
      }
    }
    for(long i = 2; (i * i) <= s; i++) {
      if((s % i) == 0) {
        p += 2;
        break;
      }
    }
    for(long i = 2; (i * i) <= t; i++) {
      if((t % i) == 0) {
        p += 2;
        break;
      }
    }
    String ans = "NO";
    if(p >= 3) ans = "YES";
    System.out.println(ans);
  }
}
0