結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー H3PO4H3PO4
提出日時 2023-08-09 14:33:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 972 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 77,676 KB
最終ジャッジ日時 2024-04-27 09:28:28
合計ジャッジ時間 14,204 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 972 ms
77,260 KB
testcase_01 AC 481 ms
76,920 KB
testcase_02 AC 482 ms
76,648 KB
testcase_03 AC 473 ms
76,664 KB
testcase_04 AC 471 ms
76,888 KB
testcase_05 AC 486 ms
76,600 KB
testcase_06 AC 500 ms
76,916 KB
testcase_07 AC 472 ms
77,064 KB
testcase_08 AC 475 ms
76,900 KB
testcase_09 AC 482 ms
77,116 KB
testcase_10 AC 376 ms
77,060 KB
testcase_11 AC 382 ms
77,076 KB
testcase_12 AC 394 ms
76,764 KB
testcase_13 AC 388 ms
77,240 KB
testcase_14 AC 407 ms
77,676 KB
testcase_15 AC 393 ms
77,112 KB
testcase_16 AC 389 ms
77,336 KB
testcase_17 AC 389 ms
77,332 KB
testcase_18 AC 386 ms
77,056 KB
testcase_19 AC 78 ms
73,992 KB
testcase_20 AC 73 ms
73,744 KB
testcase_21 AC 75 ms
74,696 KB
testcase_22 AC 72 ms
74,104 KB
testcase_23 AC 73 ms
74,276 KB
testcase_24 AC 72 ms
73,660 KB
testcase_25 AC 72 ms
74,936 KB
testcase_26 AC 72 ms
73,564 KB
testcase_27 AC 72 ms
74,292 KB
testcase_28 AC 33 ms
53,372 KB
testcase_29 AC 35 ms
52,776 KB
testcase_30 AC 34 ms
52,992 KB
testcase_31 AC 33 ms
52,960 KB
testcase_32 AC 35 ms
52,880 KB
testcase_33 AC 35 ms
52,872 KB
testcase_34 AC 34 ms
52,900 KB
testcase_35 AC 33 ms
52,624 KB
testcase_36 AC 35 ms
52,944 KB
testcase_37 AC 34 ms
54,020 KB
testcase_38 AC 33 ms
53,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(X):
    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
    factor_x = [0] * len(primes)
    prod_x = 1
    x_ = X
    for i, p in enumerate(primes):
        while not x_ % p:
            x_ //= p
            factor_x[i] += 1
        prod_x *= factor_x[i] + 1
    for n in range(2, 32):
        factor_y = factor_x.copy()
        prod_y = 1
        for i, p in enumerate(primes):
            n_ = n
            while not n_ % p:
                n_ //= p
                factor_y[i] += 1
            prod_y *= factor_y[i] + 1
        if prod_x * 2 == prod_y:
            return X * n
    return -1


T = int(input())
for _ in range(T):
    print(solve(int(input())))
0