結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー yuruhiyayuruhiya
提出日時 2021-07-22 10:18:20
言語 Crystal
(1.11.2)
結果
AC  
実行時間 1,268 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 12,645 ms
コンパイル使用メモリ 296,004 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 05:36:47
合計ジャッジ時間 23,191 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,268 ms
6,812 KB
testcase_01 AC 397 ms
6,944 KB
testcase_02 AC 389 ms
6,944 KB
testcase_03 AC 401 ms
6,940 KB
testcase_04 AC 385 ms
6,940 KB
testcase_05 AC 383 ms
6,940 KB
testcase_06 AC 395 ms
6,940 KB
testcase_07 AC 388 ms
6,940 KB
testcase_08 AC 393 ms
6,940 KB
testcase_09 AC 394 ms
6,940 KB
testcase_10 AC 205 ms
6,944 KB
testcase_11 AC 214 ms
6,940 KB
testcase_12 AC 211 ms
6,940 KB
testcase_13 AC 210 ms
6,940 KB
testcase_14 AC 210 ms
6,940 KB
testcase_15 AC 216 ms
6,940 KB
testcase_16 AC 216 ms
6,944 KB
testcase_17 AC 216 ms
6,940 KB
testcase_18 AC 213 ms
6,944 KB
testcase_19 AC 4 ms
6,944 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 4 ms
6,944 KB
testcase_22 AC 4 ms
6,944 KB
testcase_23 AC 4 ms
6,944 KB
testcase_24 AC 4 ms
6,944 KB
testcase_25 AC 4 ms
6,944 KB
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 4 ms
6,940 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 1 ms
6,940 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 1 ms
6,940 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]

def count(x, p)
  c = 0
  while x % p == 0
    x //= p
    c += 1
  end
  c
end

read_line.to_i.times do
  x = read_line.to_i64
  divisor_count = PRIMES.reduce(1) { |acc, p| acc * count(x, p).succ }
  puts x * (2..).find { |k|
    divisor_count * 2 == PRIMES.reduce(1) { |acc, p|
      acc * (count(x, p) + count(k, p) + 1)
    }
  }.not_nil!
end
0