結果
問題 | No.1611 Minimum Multiple with Double Divisors |
ユーザー | 👑 obakyan |
提出日時 | 2021-07-21 23:43:27 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,713 bytes |
コンパイル時間 | 110 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 37,504 KB |
最終ジャッジ日時 | 2024-07-17 20:44:24 |
合計ジャッジ時間 | 23,714 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,019 ms
37,432 KB |
testcase_01 | AC | 404 ms
37,432 KB |
testcase_02 | AC | 427 ms
37,312 KB |
testcase_03 | AC | 411 ms
37,432 KB |
testcase_04 | AC | 418 ms
37,504 KB |
testcase_05 | AC | 419 ms
37,420 KB |
testcase_06 | AC | 420 ms
37,376 KB |
testcase_07 | AC | 417 ms
37,496 KB |
testcase_08 | AC | 425 ms
37,376 KB |
testcase_09 | AC | 431 ms
37,376 KB |
testcase_10 | AC | 193 ms
37,432 KB |
testcase_11 | TLE | - |
testcase_12 | AC | 1,683 ms
37,484 KB |
testcase_13 | AC | 1,477 ms
37,304 KB |
testcase_14 | AC | 1,597 ms
37,456 KB |
testcase_15 | AC | 1,684 ms
37,284 KB |
testcase_16 | AC | 1,699 ms
37,376 KB |
testcase_17 | AC | 1,660 ms
37,472 KB |
testcase_18 | AC | 1,721 ms
37,376 KB |
testcase_19 | AC | 83 ms
37,456 KB |
testcase_20 | AC | 95 ms
37,444 KB |
testcase_21 | AC | 83 ms
37,376 KB |
testcase_22 | AC | 83 ms
37,428 KB |
testcase_23 | AC | 78 ms
37,376 KB |
testcase_24 | AC | 77 ms
37,368 KB |
testcase_25 | AC | 80 ms
37,376 KB |
testcase_26 | AC | 82 ms
37,464 KB |
testcase_27 | AC | 80 ms
37,372 KB |
testcase_28 | AC | 80 ms
37,504 KB |
testcase_29 | AC | 72 ms
37,480 KB |
testcase_30 | AC | 73 ms
37,464 KB |
testcase_31 | AC | 75 ms
37,408 KB |
testcase_32 | AC | 79 ms
37,376 KB |
testcase_33 | AC | 77 ms
37,376 KB |
testcase_34 | AC | 72 ms
37,376 KB |
testcase_35 | AC | 71 ms
37,412 KB |
testcase_36 | AC | 70 ms
37,376 KB |
testcase_37 | AC | 69 ms
37,504 KB |
testcase_38 | AC | 71 ms
37,376 KB |
ソースコード
local mce, mfl, msq, mmi, mma, mab = math.ceil, math.floor, math.sqrt, math.min, math.max, math.abs local function getprimes(x) local primes = {} local allnums = {} for i = 1, x do allnums[i] = true end for i = 2, x do if allnums[i] then table.insert(primes, i) local lim = mfl(x / i) for j = 2, lim do allnums[j * i] = false end end end return primes end local function getdivisorparts(x, primes) local prime_num = #primes local tmp = {} local lim = mce(msq(x)) local primepos = 1 local dv = primes[primepos] while primepos <= prime_num and dv <= lim do if x % dv == 0 then x = mfl(x / dv) local cnt = 1 while x % dv == 0 do x = mfl(x / dv) cnt = cnt + 1 end tmp[dv] = cnt lim = mce(msq(x)) end if primepos == prime_num then break end primepos = primepos + 1 dv = primes[primepos] end if x ~= 1 then tmp[x] = 1 end return tmp end local primes = getprimes(mce(msq(50 * 100000000000))) local q = io.read("*n") for iq = 1, q do local x = io.read("*n") local v = false for i = 1, #primes do local p = primes[i] if x % p ~= 0 then v = p break end end local ans = 1 * v local dvp = getdivisorparts(x, primes) local tot = 1 for k, v in pairs(dvp) do tot = tot * (1 + v) end for j = 2, ans - 1 do local dvp2 = getdivisorparts(j, primes) local tot2 = tot for k, v in pairs(dvp2) do if dvp[k] then tot2 = mfl(tot2 * (dvp[k] + v + 1) / (dvp[k] + 1)) else tot2 = tot2 * (v + 1) end end if tot * 2 == tot2 then ans = j break end end print(ans * x) end