結果

問題 No.36 素数が嫌い!
ユーザー purple_jwlpurple_jwl
提出日時 2016-10-27 12:20:12
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 10,731 ms
コンパイル使用メモリ 251,348 KB
実行使用メモリ 63,080 KB
最終ジャッジ日時 2023-09-12 06:39:59
合計ジャッジ時間 41,889 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1,065 ms
61,964 KB
testcase_02 AC 935 ms
61,688 KB
testcase_03 AC 933 ms
62,060 KB
testcase_04 AC 936 ms
61,956 KB
testcase_05 AC 939 ms
61,844 KB
testcase_06 AC 942 ms
61,928 KB
testcase_07 AC 944 ms
62,276 KB
testcase_08 AC 937 ms
61,804 KB
testcase_09 AC 937 ms
62,084 KB
testcase_10 WA -
testcase_11 AC 1,005 ms
62,216 KB
testcase_12 AC 1,092 ms
61,884 KB
testcase_13 AC 1,087 ms
62,000 KB
testcase_14 AC 1,049 ms
61,908 KB
testcase_15 AC 936 ms
61,888 KB
testcase_16 AC 929 ms
61,856 KB
testcase_17 AC 943 ms
61,808 KB
testcase_18 AC 923 ms
62,228 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,038 ms
61,740 KB
testcase_25 WA -
testcase_26 AC 1,038 ms
62,008 KB
testcase_27 AC 1,082 ms
61,900 KB
testcase_28 AC 1,031 ms
61,924 KB
testcase_29 AC 1,096 ms
62,120 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
      }
    }

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