結果

問題 No.2016 Countdown Divisors
ユーザー simansiman
提出日時 2022-07-23 10:11:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 11,148 KB
実行使用メモリ 15,388 KB
最終ジャッジ日時 2023-09-18 04:17:04
合計ジャッジ時間 6,841 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,108 KB
testcase_01 AC 223 ms
15,328 KB
testcase_02 AC 228 ms
15,360 KB
testcase_03 AC 216 ms
15,244 KB
testcase_04 AC 199 ms
15,388 KB
testcase_05 AC 194 ms
15,144 KB
testcase_06 AC 122 ms
15,208 KB
testcase_07 AC 121 ms
15,264 KB
testcase_08 AC 227 ms
15,236 KB
testcase_09 AC 225 ms
15,264 KB
testcase_10 AC 232 ms
15,320 KB
testcase_11 AC 229 ms
15,240 KB
testcase_12 AC 229 ms
15,308 KB
testcase_13 AC 220 ms
15,104 KB
testcase_14 AC 215 ms
15,184 KB
testcase_15 AC 212 ms
15,136 KB
testcase_16 AC 224 ms
15,328 KB
testcase_17 AC 217 ms
15,344 KB
testcase_18 AC 218 ms
15,236 KB
testcase_19 AC 80 ms
15,104 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

T = gets.to_i

T.times do
  n = gets.to_i

  if [1, 3, 4, 5, 7, 8].include?(n)
    puts 1
  else
    puts 2
  end
end
0