結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー ntudantuda
提出日時 2021-12-10 18:33:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,201 bytes
コンパイル時間 993 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 81,972 KB
最終ジャッジ日時 2023-09-25 15:30:53
合計ジャッジ時間 14,484 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 288 ms
79,040 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 240 ms
80,264 KB
testcase_11 AC 231 ms
80,356 KB
testcase_12 AC 237 ms
79,588 KB
testcase_13 AC 270 ms
81,284 KB
testcase_14 AC 251 ms
81,104 KB
testcase_15 AC 257 ms
80,872 KB
testcase_16 AC 244 ms
80,208 KB
testcase_17 AC 268 ms
80,904 KB
testcase_18 AC 237 ms
79,716 KB
testcase_19 AC 99 ms
76,880 KB
testcase_20 AC 90 ms
76,572 KB
testcase_21 AC 98 ms
76,932 KB
testcase_22 AC 98 ms
77,092 KB
testcase_23 AC 91 ms
76,248 KB
testcase_24 AC 93 ms
76,824 KB
testcase_25 AC 94 ms
76,576 KB
testcase_26 AC 92 ms
76,656 KB
testcase_27 AC 99 ms
76,952 KB
testcase_28 AC 70 ms
71,044 KB
testcase_29 AC 70 ms
71,360 KB
testcase_30 AC 72 ms
71,344 KB
testcase_31 AC 71 ms
71,412 KB
testcase_32 AC 71 ms
71,392 KB
testcase_33 AC 72 ms
71,476 KB
testcase_34 AC 71 ms
71,392 KB
testcase_35 AC 72 ms
71,328 KB
testcase_36 AC 72 ms
71,332 KB
testcase_37 AC 72 ms
71,268 KB
testcase_38 AC 72 ms
71,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
PL = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
fmin = 10 ** 18
N = [int(input()) for _ in range(T)]

for n2 in N:
    n = n2
    dic = {}
    for p in PL:
        cnt = 0
        while n % p == 0:
            n //= p
            cnt += 1
        if cnt == 0:
            # 素因数に含まれない最小の素数
            fmin = p
            break
        #dic[0].remove(p)
        if cnt in dic:
            dic[cnt].add(p)
        else:
            dic[cnt] = {p}

    # 素因数の数が1の最小の素数の2乗
    if 1 in dic:
        fmin = min(fmin, min(dic[1]) ** 2)
    # 素因数の数が2の最小の素数の3乗
    if 2 in dic:
        fmin = min(fmin, min(dic[2]) ** 3)
    # 素因数の数が3の最小の素数の4乗
    if 3 in dic:
        fmin = min(fmin, min(dic[3]) ** 4)
    # 素因数の数が1の最小の素数と素因数の数が2の最小の素数の積
    if 1 in dic and 2 in dic:
        fmin = min(fmin, min(dic[1]) * min(dic[2]))
        # 素因数の数が2の最小の素数と素因数の数が3の最小の素数の積
    if 2 in dic and 3 in dic:
        fmin = min(fmin, min(dic[2]) * min(dic[3]) ** 2)

    print(fmin * n2)



0