結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー hir355hir355
提出日時 2021-07-21 22:14:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 80,152 KB
最終ジャッジ日時 2023-09-24 18:11:59
合計ジャッジ時間 12,867 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 414 ms
77,808 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 388 ms
79,840 KB
testcase_11 AC 367 ms
78,716 KB
testcase_12 AC 384 ms
79,192 KB
testcase_13 AC 413 ms
79,364 KB
testcase_14 AC 373 ms
78,772 KB
testcase_15 AC 364 ms
78,400 KB
testcase_16 AC 370 ms
78,608 KB
testcase_17 AC 374 ms
78,780 KB
testcase_18 AC 398 ms
79,396 KB
testcase_19 AC 116 ms
78,304 KB
testcase_20 AC 112 ms
77,284 KB
testcase_21 AC 117 ms
78,112 KB
testcase_22 AC 122 ms
78,096 KB
testcase_23 AC 102 ms
76,704 KB
testcase_24 AC 123 ms
78,964 KB
testcase_25 AC 111 ms
77,992 KB
testcase_26 AC 107 ms
77,184 KB
testcase_27 AC 111 ms
77,244 KB
testcase_28 AC 74 ms
71,700 KB
testcase_29 AC 74 ms
71,484 KB
testcase_30 AC 72 ms
71,452 KB
testcase_31 AC 74 ms
71,668 KB
testcase_32 AC 73 ms
71,568 KB
testcase_33 AC 71 ms
71,852 KB
testcase_34 AC 72 ms
71,456 KB
testcase_35 AC 72 ms
71,568 KB
testcase_36 AC 73 ms
71,412 KB
testcase_37 AC 72 ms
71,864 KB
testcase_38 AC 75 ms
71,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

pr = primes(200)
t = int(input())
for _ in range(t):
    x = int(input())
    ans = 10 ** 18
    l = [(0, 100000)]
    tmp = 1
    for p in pr:
        cnt = 1
        t = x
        while t % p == 0:
            t //= p
            cnt += 1
        if l[-1][1] > cnt:
            res = x
            l.append((p, cnt))
            for i in range(len(l) - 1, 0, -1):
                if l[i - 1][1] >= cnt * 2:
                    res *= pow(l[i][0], cnt * 2 - l[i][1])
                    break
                else:
                    res *= pow(l[i][0], l[i - 1][1] - l[i][1])
            ans = min(ans, res)
        if x % tmp > 0:
            break
        tmp = p
    print(ans)
0