結果

問題 No.888 約数の総和
ユーザー simansiman
提出日時 2020-05-14 17:44:04
言語 Ruby
(3.3.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 11,552 KB
実行使用メモリ 15,588 KB
最終ジャッジ日時 2023-10-13 16:18:15
合計ジャッジ時間 5,589 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,488 KB
testcase_01 AC 79 ms
15,512 KB
testcase_02 AC 77 ms
15,544 KB
testcase_03 AC 77 ms
15,412 KB
testcase_04 AC 76 ms
15,424 KB
testcase_05 AC 77 ms
15,388 KB
testcase_06 AC 81 ms
15,516 KB
testcase_07 AC 77 ms
15,544 KB
testcase_08 AC 83 ms
15,412 KB
testcase_09 AC 82 ms
15,420 KB
testcase_10 AC 82 ms
15,588 KB
testcase_11 AC 84 ms
15,388 KB
testcase_12 AC 81 ms
15,388 KB
testcase_13 AC 82 ms
15,336 KB
testcase_14 AC 79 ms
15,348 KB
testcase_15 AC 77 ms
15,540 KB
testcase_16 AC 77 ms
15,496 KB
testcase_17 AC 77 ms
15,392 KB
testcase_18 AC 78 ms
15,124 KB
testcase_19 AC 78 ms
15,436 KB
testcase_20 AC 77 ms
15,292 KB
testcase_21 AC 80 ms
15,388 KB
testcase_22 AC 77 ms
15,220 KB
testcase_23 AC 78 ms
15,284 KB
testcase_24 AC 77 ms
15,320 KB
testcase_25 AC 82 ms
15,288 KB
testcase_26 AC 84 ms
15,380 KB
testcase_27 AC 109 ms
15,340 KB
testcase_28 AC 91 ms
15,424 KB
testcase_29 AC 83 ms
15,416 KB
testcase_30 AC 90 ms
15,456 KB
testcase_31 AC 79 ms
15,588 KB
testcase_32 AC 78 ms
15,400 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Integer
  def divisor_list
    require 'prime'

    return [] if self <= 0
    return [1] if self == 1

    prime_division.map.with_index { |(base, k), i|
      s = i.zero? ? 0 : 1
      (s..k).map { |n| base ** n }
    }.inject { |res, e| res + res.flat_map { |t| e.map { |v| t * v } } }.sort
  end
end

N = gets.to_i

puts N.divisor_list.sum
0