結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-07-21 21:59:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,614 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 88,960 KB
最終ジャッジ日時 2023-09-24 17:23:15
合計ジャッジ時間 44,563 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 1,460 ms
85,560 KB
testcase_11 AC 1,589 ms
87,580 KB
testcase_12 AC 1,539 ms
87,284 KB
testcase_13 AC 1,435 ms
88,208 KB
testcase_14 AC 1,435 ms
87,440 KB
testcase_15 AC 1,463 ms
88,276 KB
testcase_16 AC 1,462 ms
88,224 KB
testcase_17 AC 1,457 ms
87,216 KB
testcase_18 AC 1,441 ms
88,652 KB
testcase_19 AC 142 ms
77,964 KB
testcase_20 AC 141 ms
78,224 KB
testcase_21 AC 133 ms
77,868 KB
testcase_22 AC 136 ms
78,000 KB
testcase_23 AC 135 ms
77,852 KB
testcase_24 AC 133 ms
77,880 KB
testcase_25 AC 137 ms
77,764 KB
testcase_26 AC 139 ms
78,100 KB
testcase_27 AC 140 ms
77,860 KB
testcase_28 AC 103 ms
77,132 KB
testcase_29 AC 103 ms
76,652 KB
testcase_30 AC 108 ms
76,888 KB
testcase_31 AC 106 ms
76,980 KB
testcase_32 AC 104 ms
76,920 KB
testcase_33 AC 108 ms
76,844 KB
testcase_34 AC 106 ms
76,668 KB
testcase_35 AC 106 ms
76,984 KB
testcase_36 AC 106 ms
76,672 KB
testcase_37 AC 106 ms
77,100 KB
testcase_38 AC 106 ms
76,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

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

2*2

2->4

2倍を素因数分解する

A * B * C

最小の含まれない素因数は割と小さいはず
それ以下に関して、探索する

31以下

2*3*5*7*11*13*17*19*23*29*31
で、10個

この内、積で31未満の物

4
8
16
9
27
25


"""

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(32)
#print (plis)

tt = int(stdin.readline())
ANS = []

for loop in range(tt):

    X = int(stdin.readline())

    XN = 1
    TX = X
    for p in plis:
        now = 1
        while TX % p == 0:
            now += 1
            TX //= p
        XN *= now

    ans = float("inf")

    for i in range(2,32):

        NY = X * i
        if NY % X != 0:
            continue
        
        YN = 1
        TY = NY
        for p in plis:
            now = 1
            while TY % p == 0:
                now += 1
                TY //= p
            YN *= now

        if YN == XN * 2:
            ans = min(ans,NY)

    ANS.append(str(ans))

print ("\n".join(ANS))
0