結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 👑 rin204
提出日時 2022-01-26 16:52:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 947 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 1,584 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 77,400 KB
最終ジャッジ日時 2024-12-23 08:21:55
合計ジャッジ時間 13,244 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
def solve():
    x = int(input())
    C = [0] * 32
    X = x
    for p in prime:
        cnt = 0
        while X % p == 0:
            X //= p
            cnt += 1
        C[p] = cnt
    for i in range(2, 32):
        if x % i != 0:
            print(x * i)
            return
        a = 1
        b = 1
        X = x
        I = i
        for p in prime:
            if I % p == 0:
                cnt = C[p]
                b *= cnt + 1
                while I % p == 0:
                    I //= p
                    cnt += 1
                a *= cnt + 1
        if a == 2 * b:
            print(x * i)
            return
            
    
for _ in range(int(input())):
    solve()
0