結果

問題 No.36 素数が嫌い!
ユーザー purple_jwlpurple_jwl
提出日時 2016-10-27 12:27:45
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,062 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 10,275 ms
コンパイル使用メモリ 258,908 KB
実行使用メモリ 62,268 KB
最終ジャッジ日時 2023-09-12 06:42:25
合計ジャッジ時間 40,865 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 967 ms
62,044 KB
testcase_01 AC 1,030 ms
61,792 KB
testcase_02 AC 886 ms
61,988 KB
testcase_03 AC 887 ms
61,832 KB
testcase_04 AC 893 ms
61,916 KB
testcase_05 AC 908 ms
61,948 KB
testcase_06 AC 901 ms
61,764 KB
testcase_07 AC 903 ms
61,772 KB
testcase_08 AC 907 ms
61,712 KB
testcase_09 AC 896 ms
61,776 KB
testcase_10 AC 908 ms
61,852 KB
testcase_11 AC 960 ms
61,780 KB
testcase_12 AC 1,045 ms
61,888 KB
testcase_13 AC 1,058 ms
62,268 KB
testcase_14 AC 1,007 ms
61,772 KB
testcase_15 AC 904 ms
62,232 KB
testcase_16 AC 889 ms
61,728 KB
testcase_17 AC 894 ms
61,808 KB
testcase_18 AC 899 ms
62,148 KB
testcase_19 AC 976 ms
61,792 KB
testcase_20 AC 1,062 ms
61,920 KB
testcase_21 AC 1,030 ms
61,808 KB
testcase_22 AC 1,024 ms
61,960 KB
testcase_23 AC 991 ms
61,712 KB
testcase_24 AC 987 ms
61,864 KB
testcase_25 AC 981 ms
61,792 KB
testcase_26 AC 996 ms
62,072 KB
testcase_27 AC 1,029 ms
61,700 KB
testcase_28 AC 990 ms
62,032 KB
testcase_29 AC 1,040 ms
61,808 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[Long]()

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

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

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