結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー ntudantuda
提出日時 2021-12-10 18:46:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,485 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 83,832 KB
最終ジャッジ日時 2023-09-25 15:45:26
合計ジャッジ時間 11,865 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
78,892 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 260 ms
80,412 KB
testcase_11 AC 255 ms
79,704 KB
testcase_12 AC 254 ms
81,020 KB
testcase_13 AC 273 ms
81,572 KB
testcase_14 AC 263 ms
80,024 KB
testcase_15 AC 270 ms
81,536 KB
testcase_16 AC 264 ms
80,528 KB
testcase_17 AC 292 ms
80,892 KB
testcase_18 AC 251 ms
80,172 KB
testcase_19 AC 95 ms
76,704 KB
testcase_20 AC 92 ms
76,228 KB
testcase_21 AC 98 ms
76,748 KB
testcase_22 AC 98 ms
76,960 KB
testcase_23 AC 92 ms
76,420 KB
testcase_24 AC 93 ms
76,544 KB
testcase_25 AC 90 ms
76,536 KB
testcase_26 AC 92 ms
76,560 KB
testcase_27 AC 95 ms
76,836 KB
testcase_28 AC 72 ms
71,168 KB
testcase_29 AC 69 ms
71,164 KB
testcase_30 AC 70 ms
71,212 KB
testcase_31 AC 70 ms
71,376 KB
testcase_32 AC 71 ms
71,260 KB
testcase_33 AC 70 ms
71,180 KB
testcase_34 AC 72 ms
71,212 KB
testcase_35 AC 71 ms
70,856 KB
testcase_36 AC 71 ms
70,884 KB
testcase_37 AC 71 ms
71,168 KB
testcase_38 AC 70 ms
71,020 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}

    # 素因数の数が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)
    # 素因数の数が3の最小の素数の4乗
    if 4 in dic:
        fmin = min(fmin, min(dic[4]) ** 5)
    # 素因数の数が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)
    # 素因数の数が2の最小の素数と素因数の数が3の最小の素数の積
    if 3 in dic and 4 in dic:
        fmin = min(fmin, min(dic[3]) * min(dic[4]) ** 3)
    print(fmin * n2)

0