結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-07-21 21:34:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,114 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 99,060 KB
最終ジャッジ日時 2023-09-24 15:59:30
合計ジャッジ時間 11,006 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 300 ms
97,864 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 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 148 ms
97,180 KB
testcase_29 AC 143 ms
97,180 KB
testcase_30 AC 148 ms
97,280 KB
testcase_31 AC 140 ms
97,060 KB
testcase_32 AC 139 ms
97,072 KB
testcase_33 AC 139 ms
97,064 KB
testcase_34 AC 142 ms
96,808 KB
testcase_35 WA -
testcase_36 AC 142 ms
97,036 KB
testcase_37 AC 139 ms
97,184 KB
testcase_38 AC 139 ms
97,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

6 = 2 * 3
24 = 2*2*2*6

2*2

2->4

"""

from sys import stdin
import sys
from collections import deque

def Sieve(n): #n以下の素数全列挙(O(nloglogn)) retは素数が入ってる。divlisはその数字の素因数が一つ入ってる

    ret = []
    divlis = [-1] * (n+1) #何で割ったかのリスト(初期値は-1)
    
    flag = [True] * (n+1)
    flag[0] = False
    flag[1] = False

    ind = 2
    while ind <= n:

        if flag[ind]:
            ret.append(ind)

            ind2 = ind ** 2

            while ind2 <= n:
                flag[ind2] = False
                divlis[ind2] = ind
                ind2 += ind

        ind += 1

    return ret,divlis

plis,tmp = Sieve(1000000)

tt = int(stdin.readline())

for loop in range(tt):

    X = int(stdin.readline())

    ans = float("inf")
    for p in plis:
        if ans < X * p:
            break

        divnum = 0
        TX = X
        while TX % p == 0:
            divnum += 1
            TX //= p

        mlp = 2 * (divnum + 1) - 1 - divnum
        #print (p,mlp)
        ans = min(ans , X * (p**mlp))

    print (ans)
0