結果

問題 No.36 素数が嫌い!
ユーザー purple_jwl
提出日時 2016-10-27 12:27:45
言語 Scala(Beta)
(3.6.2)
結果
AC  
実行時間 1,046 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 9,679 ms
コンパイル使用メモリ 270,016 KB
実行使用メモリ 62,924 KB
最終ジャッジ日時 2024-06-29 19:42:47
合計ジャッジ時間 38,321 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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