結果

問題 No.1737 One to N
ユーザー yudedakoyudedako
提出日時 2022-01-25 13:30:34
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 918 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 8,371 ms
コンパイル使用メモリ 245,608 KB
実行使用メモリ 62,116 KB
最終ジャッジ日時 2023-08-22 07:07:02
合計ジャッジ時間 38,387 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 906 ms
61,656 KB
testcase_01 AC 898 ms
61,188 KB
testcase_02 AC 898 ms
61,988 KB
testcase_03 AC 896 ms
61,456 KB
testcase_04 AC 893 ms
61,580 KB
testcase_05 AC 913 ms
61,536 KB
testcase_06 AC 907 ms
62,116 KB
testcase_07 AC 904 ms
61,596 KB
testcase_08 AC 888 ms
61,648 KB
testcase_09 AC 889 ms
61,520 KB
testcase_10 AC 889 ms
61,556 KB
testcase_11 AC 889 ms
61,292 KB
testcase_12 AC 894 ms
61,544 KB
testcase_13 AC 900 ms
61,268 KB
testcase_14 AC 898 ms
61,460 KB
testcase_15 AC 897 ms
61,616 KB
testcase_16 AC 911 ms
61,464 KB
testcase_17 AC 908 ms
61,624 KB
testcase_18 AC 918 ms
61,640 KB
testcase_19 AC 914 ms
61,572 KB
testcase_20 AC 908 ms
61,536 KB
testcase_21 AC 917 ms
61,492 KB
testcase_22 AC 909 ms
61,592 KB
testcase_23 AC 908 ms
61,592 KB
testcase_24 AC 909 ms
61,332 KB
testcase_25 AC 907 ms
61,512 KB
testcase_26 AC 899 ms
61,100 KB
testcase_27 AC 898 ms
61,188 KB
testcase_28 AC 905 ms
61,372 KB
testcase_29 AC 891 ms
61,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.annotation.tailrec
import scala.io.StdIn.*



def primeFactors(value: Int): List[Int] =
  def inner(v: Int, p: Int): List[Int] =
    v match
      case 1 => Nil
      case _ if p * p > v => v::Nil
      case _ if v % p == 0 => p::inner(v / p, p)
      case _ => inner(v, p + 1)
  inner(value, 2)

@main def main =
  val n = readLine().toInt
  val factor = primeFactors(n)
  println(factor.sum)
0