結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー rlangevinrlangevin
提出日時 2023-04-20 23:16:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 611 ms / 2,000 ms
コード長 1,020 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 78,292 KB
最終ジャッジ日時 2024-04-23 17:19:06
合計ジャッジ時間 9,180 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 611 ms
78,292 KB
testcase_01 AC 289 ms
77,468 KB
testcase_02 AC 285 ms
77,568 KB
testcase_03 AC 287 ms
77,744 KB
testcase_04 AC 287 ms
77,412 KB
testcase_05 AC 280 ms
77,548 KB
testcase_06 AC 287 ms
77,772 KB
testcase_07 AC 279 ms
78,016 KB
testcase_08 AC 279 ms
77,644 KB
testcase_09 AC 286 ms
77,480 KB
testcase_10 AC 180 ms
77,772 KB
testcase_11 AC 197 ms
77,692 KB
testcase_12 AC 198 ms
78,000 KB
testcase_13 AC 200 ms
77,496 KB
testcase_14 AC 190 ms
77,564 KB
testcase_15 AC 199 ms
77,988 KB
testcase_16 AC 194 ms
77,572 KB
testcase_17 AC 197 ms
77,908 KB
testcase_18 AC 205 ms
77,880 KB
testcase_19 AC 80 ms
77,180 KB
testcase_20 AC 74 ms
74,568 KB
testcase_21 AC 84 ms
77,104 KB
testcase_22 AC 72 ms
74,628 KB
testcase_23 AC 79 ms
77,580 KB
testcase_24 AC 78 ms
77,168 KB
testcase_25 AC 84 ms
77,372 KB
testcase_26 AC 82 ms
77,276 KB
testcase_27 AC 70 ms
74,332 KB
testcase_28 AC 37 ms
54,892 KB
testcase_29 AC 36 ms
55,224 KB
testcase_30 AC 36 ms
55,040 KB
testcase_31 AC 39 ms
56,192 KB
testcase_32 AC 39 ms
54,524 KB
testcase_33 AC 37 ms
54,440 KB
testcase_34 AC 36 ms
55,160 KB
testcase_35 AC 37 ms
54,896 KB
testcase_36 AC 39 ms
54,756 KB
testcase_37 AC 39 ms
55,116 KB
testcase_38 AC 41 ms
54,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline
from collections import *

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    return arr

T = int(readline())
L = [None] * 32
for i in range(2, 32):
    L[i] = factorization(i)
    
prime = [2,3,5,7,11,13,17,19,23,29,31]
for _ in range(T):
    X = int(readline())
    XX = X
    D = defaultdict(int)
    for p in prime:
        while X % p == 0:
            D[p] += 1
            X //= p
    num = 1
    for k, v in D.items():
        num *= v + 1
        
    for i in range(2, 32):
        for j, cnt in L[i]:
            D[j] += cnt
        num2 = 1
        for k, v in D.items():
            num2 *= v + 1
        if num2 == num * 2:
            print(i * XX)
            break
        for j, cnt in L[i]:
            D[j] -= cnt
0