結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー ntudantuda
提出日時 2021-12-11 13:01:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,161 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 82,996 KB
最終ジャッジ日時 2023-09-26 23:23:50
合計ジャッジ時間 13,505 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
78,680 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 291 ms
80,932 KB
testcase_11 AC 279 ms
81,028 KB
testcase_12 AC 276 ms
80,608 KB
testcase_13 AC 305 ms
80,584 KB
testcase_14 AC 287 ms
81,192 KB
testcase_15 AC 300 ms
81,024 KB
testcase_16 AC 298 ms
81,740 KB
testcase_17 AC 287 ms
79,820 KB
testcase_18 AC 283 ms
80,432 KB
testcase_19 AC 109 ms
76,504 KB
testcase_20 AC 100 ms
76,504 KB
testcase_21 AC 107 ms
77,516 KB
testcase_22 AC 107 ms
77,316 KB
testcase_23 AC 102 ms
76,596 KB
testcase_24 AC 98 ms
76,556 KB
testcase_25 AC 100 ms
76,620 KB
testcase_26 AC 100 ms
76,436 KB
testcase_27 AC 108 ms
76,628 KB
testcase_28 AC 78 ms
71,328 KB
testcase_29 AC 76 ms
71,424 KB
testcase_30 AC 74 ms
71,112 KB
testcase_31 AC 75 ms
71,224 KB
testcase_32 AC 78 ms
71,232 KB
testcase_33 AC 80 ms
71,076 KB
testcase_34 AC 78 ms
71,104 KB
testcase_35 AC 79 ms
71,216 KB
testcase_36 AC 78 ms
71,256 KB
testcase_37 AC 76 ms
71,336 KB
testcase_38 AC 75 ms
71,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
PL = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,37]
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}


    d1,d2,d3,d4,d5,d8 = 100,100,100,100,100,100

    if 1 in dic:
        d1 = min(dic[1])
        fmin = min(fmin, d1 ** 2)
    if 2 in dic:
        d2 = min(dic[2])
        fmin = min(fmin, d2 ** 3)
    if 3 in dic:
        d3 = min(dic[3])
        fmin = min(fmin, d3 ** 4)
    if 5 in dic:
        d5 = min(dic[5])
        fmin = min(fmin, d1 * d5 ** 2)
    if 8 in dic:
        d8 = min(dic[8])
        fmin = min(fmin, d1 * d8 ** 3)

    fmin = min(fmin, d1 * d2)
    fmin = min(fmin, d2 * d3 ** 2)
    fmin = min(fmin, d2 * d5 ** 3)
    fmin = min(fmin, d2 * d3 * d4)
    fmin = min(fmin, d2 ** 2 * d4)
    fmin = min(fmin, d3 * d4 ** 3)

    print(fmin * n2)
0