結果

問題 No.36 素数が嫌い!
ユーザー purple_jwlpurple_jwl
提出日時 2016-10-27 12:26:03
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,108 ms / 5,000 ms
コード長 421 bytes
コンパイル時間 9,103 ms
コンパイル使用メモリ 259,708 KB
実行使用メモリ 62,696 KB
最終ジャッジ日時 2023-09-12 06:40:47
合計ジャッジ時間 40,380 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,032 ms
62,140 KB
testcase_01 AC 1,076 ms
61,972 KB
testcase_02 AC 927 ms
61,920 KB
testcase_03 AC 926 ms
62,204 KB
testcase_04 AC 928 ms
61,916 KB
testcase_05 AC 939 ms
62,232 KB
testcase_06 AC 942 ms
61,888 KB
testcase_07 AC 942 ms
61,980 KB
testcase_08 AC 947 ms
61,972 KB
testcase_09 AC 939 ms
62,120 KB
testcase_10 AC 933 ms
62,076 KB
testcase_11 AC 998 ms
62,092 KB
testcase_12 AC 1,088 ms
61,948 KB
testcase_13 AC 1,079 ms
62,140 KB
testcase_14 AC 1,040 ms
62,176 KB
testcase_15 AC 921 ms
61,892 KB
testcase_16 AC 940 ms
61,876 KB
testcase_17 AC 922 ms
61,776 KB
testcase_18 AC 927 ms
61,820 KB
testcase_19 AC 1,055 ms
62,100 KB
testcase_20 AC 1,108 ms
61,896 KB
testcase_21 AC 1,045 ms
61,984 KB
testcase_22 AC 1,065 ms
62,256 KB
testcase_23 AC 1,030 ms
61,968 KB
testcase_24 AC 1,040 ms
62,696 KB
testcase_25 AC 1,035 ms
62,136 KB
testcase_26 AC 1,016 ms
61,876 KB
testcase_27 AC 1,066 ms
62,008 KB
testcase_28 AC 1,027 ms
61,932 KB
testcase_29 AC 1,092 ms
62,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = {
    var n = StdIn.readLong

    val memo = ArrayBuffer[Int]()

    for (i <- (2 to Math.sqrt(n).toInt + 1)) {
      while (n % i == 0) {
        memo += i
        n /= i
      }
    }

    if (n != 1) {
      memo += n.toInt
    }

    println(
      if (memo.size > 2) "YES" else "NO"
    )
  }
}
0