結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー Mine
提出日時 2021-09-10 14:22:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 695 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 78,988 KB
最終ジャッジ日時 2025-01-03 05:59:13
合計ジャッジ時間 15,110 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


def prime_factorization(n):
    arr = defaultdict(int)
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            arr[i] += 1
            n //= i
    if n != 1:
        arr[n] += 1
    return arr


t = int(input())
ans = []
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
options = [prime_factorization(i) for i in range(0, 32)]

for i in range(t):
    x = int(input())
    d = defaultdict(int)
    for p in primes:
        temp = x
        while temp % p == 0:
            d[p] += 1
            temp //= p
    for i in range(2, 32):
        xnum = 1
        opnum = 1
        for p in options[i]:
            xnum *= (d[p]+1)
            opnum *= (d[p] + options[i][p] + 1)
        if 2*xnum == opnum:
            break
    print(i*x)
0