結果

問題 No.36 素数が嫌い!
ユーザー purple_jwl
提出日時 2016-10-27 12:26:03
言語 Scala(Beta)
(3.6.2)
結果
AC  
実行時間 1,015 ms / 5,000 ms
コード長 421 bytes
コンパイル時間 8,207 ms
コンパイル使用メモリ 258,992 KB
実行使用メモリ 64,624 KB
最終ジャッジ日時 2024-06-29 19:41:16
合計ジャッジ時間 38,054 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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[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