結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-07-21 21:43:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,128 bytes
コンパイル時間 1,457 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 99,068 KB
最終ジャッジ日時 2023-09-24 16:16:58
合計ジャッジ時間 11,459 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 304 ms
97,756 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 152 ms
96,924 KB
testcase_29 AC 153 ms
97,312 KB
testcase_30 AC 159 ms
97,052 KB
testcase_31 AC 155 ms
97,032 KB
testcase_32 AC 148 ms
97,128 KB
testcase_33 AC 150 ms
97,256 KB
testcase_34 AC 149 ms
97,136 KB
testcase_35 WA -
testcase_36 AC 156 ms
97,012 KB
testcase_37 AC 155 ms
97,016 KB
testcase_38 AC 163 ms
97,016 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 = divnum + 1
        #print (p,mlp)
        ans = min(ans , X * (p**mlp))
        #print (p,X * (p**mlp))

    print (ans)
0