結果

問題 No.537 ユーザーID
ユーザー simansiman
提出日時 2020-07-03 12:37:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 11,392 KB
実行使用メモリ 16,324 KB
最終ジャッジ日時 2023-10-14 22:45:23
合計ジャッジ時間 5,013 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
15,188 KB
testcase_01 AC 96 ms
15,404 KB
testcase_02 AC 95 ms
15,448 KB
testcase_03 AC 97 ms
15,208 KB
testcase_04 AC 96 ms
15,208 KB
testcase_05 AC 97 ms
15,344 KB
testcase_06 AC 96 ms
15,344 KB
testcase_07 AC 97 ms
15,332 KB
testcase_08 AC 96 ms
15,320 KB
testcase_09 AC 97 ms
15,188 KB
testcase_10 AC 94 ms
15,300 KB
testcase_11 AC 96 ms
15,332 KB
testcase_12 AC 96 ms
15,156 KB
testcase_13 AC 94 ms
15,420 KB
testcase_14 AC 96 ms
15,392 KB
testcase_15 AC 96 ms
15,272 KB
testcase_16 AC 95 ms
15,392 KB
testcase_17 AC 95 ms
15,308 KB
testcase_18 AC 96 ms
15,204 KB
testcase_19 AC 99 ms
15,464 KB
testcase_20 AC 182 ms
15,612 KB
testcase_21 AC 97 ms
15,200 KB
testcase_22 AC 95 ms
15,460 KB
testcase_23 AC 96 ms
15,488 KB
testcase_24 AC 93 ms
15,096 KB
testcase_25 AC 94 ms
15,464 KB
testcase_26 AC 94 ms
15,364 KB
testcase_27 AC 95 ms
15,612 KB
testcase_28 AC 106 ms
15,864 KB
testcase_29 AC 113 ms
16,164 KB
testcase_30 AC 114 ms
16,324 KB
testcase_31 AC 94 ms
15,440 KB
testcase_32 AC 93 ms
15,532 KB
testcase_33 AC 100 ms
15,648 KB
testcase_34 AC 95 ms
15,468 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
pass = Hash.new

N.divisor_list.each do |n|
  m = N / n

  pass[n.to_s + m.to_s] = true
  pass[m.to_s + n.to_s] = true
end

puts pass.size

0