結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー tassei903tassei903
提出日時 2021-07-21 22:00:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,146 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 88,484 KB
最終ジャッジ日時 2023-09-24 17:31:39
合計ジャッジ時間 7,590 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")
#######################################################################

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

pl = [2,3,5,7,11,13,17,19,23,29,31,37,41]
z = len(pl)
T = ni()
from collections import defaultdict
for i in range(T):
    x = ni()
    if x==1:
        print(2)
        continue
    d = factorization(x)
    used = defaultdict(bool)
    ans = 10**14
    #print(d)
    for j,y in d:
        ans = min(ans, pow(j,y+1))
        if j<=41:
            used[j]=True
    for j in pl:
        if not used[j]:
            ans = min(ans,j)
            break
    print(x*ans)
0