結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー simansiman
提出日時 2021-07-27 09:58:07
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 396 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 11,556 KB
実行使用メモリ 21,000 KB
最終ジャッジ日時 2023-09-30 07:54:55
合計ジャッジ時間 23,853 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,871 ms
20,920 KB
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 WA -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

T = gets.to_i
X = T.times.map { gets.to_i }

X.each do |x|
  prm = x.prime_division

  if prm.empty?
    puts 2
  else
    counter = prm.to_h
    ans = Float::INFINITY

    Prime.each.take(12).each do |e|
      v = if counter[e].nil?
            x * e
          else
            x * (e ** (counter[e] + 1))
          end

      ans = v if ans > v
    end

    puts ans
  end
end
0