結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー hirakuhiraku
提出日時 2022-02-12 23:06:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,054 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 86,428 KB
実行使用メモリ 84,460 KB
最終ジャッジ日時 2023-09-11 11:47:05
合計ジャッジ時間 15,330 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,115 ms
79,644 KB
testcase_01 AC 689 ms
79,380 KB
testcase_02 AC 677 ms
79,048 KB
testcase_03 AC 700 ms
79,804 KB
testcase_04 AC 716 ms
79,812 KB
testcase_05 AC 696 ms
78,420 KB
testcase_06 AC 693 ms
78,516 KB
testcase_07 AC 668 ms
78,260 KB
testcase_08 AC 691 ms
78,724 KB
testcase_09 AC 672 ms
78,760 KB
testcase_10 AC 577 ms
80,468 KB
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# https://yukicoder.me/problems/no/1611
# No.1611 Minimum Multiple with Double Divisors

# 素因数分解と約数の個数

# X = (p1 ** m1) * (p2 ** m2) * ... * (pk ** mk)
# と素因数分解されたとします. このとき, の正の約数の個数は 
# (m1 + 1)(m2 + 1)...(mk + 1) です.


from collections import defaultdict


def prime_factorize(n):
    # 素因数分解 defaultdict
    a = defaultdict(int)
    while n % 2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] += 1
    return a

t = int(input())
for _ in range(t):
    x = int(input())
    p = prime_factorize(x)
    cnt = 1
    for i in p.values():
        cnt *= (i + 1)
    for i in range(2, 32):
        ps = prime_factorize(i)
        dnt = cnt
        for k, v in ps.items():
            dnt = dnt // (p[k] + 1) * (p[k] + v + 1)
        if dnt == cnt * 2:
            print(i * x)
            break
        
        
0