結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー horitaka1999
提出日時 2021-07-23 00:48:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,395 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 80,624 KB
最終ジャッジ日時 2024-10-03 02:54:21
合計ジャッジ時間 31,724 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

primes = [2,3,5,7,11,13,17,19,23,29,31]
from collections import defaultdict
def f(x):
    tmp = x
    yaku1 = 1
    dic = defaultdict(int)
    coordinate = []
    for p in primes:
        cnt = 0
        while tmp % p == 0:
            tmp = tmp//p
            cnt += 1
        dic[p] = cnt
        yaku1 *= (cnt+1)
        coordinate.append(p**(cnt+1))
    for i in range(2,32):
        tmp = i
        yaku2 = 1
        for p in primes:
            cnt = 0
            while tmp % p == 0:
                tmp = tmp //p
                cnt += 1
            yaku2 *= (dic[p]+1+cnt)
        if 2 * yaku1 == yaku2:
            coordinate.append(i)


    return min(coordinate) * x 
T = int(input())
store = []
for _ in range(T):
    x = int(input())
    store.append(x)
for x in store:
    print(f(x))
0