結果
| 問題 |
No.1611 Minimum Multiple with Double Divisors
|
| コンテスト | |
| ユーザー |
👑 SPD_9X2
|
| 提出日時 | 2021-07-21 21:59:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,614 bytes |
| コンパイル時間 | 339 ms |
| コンパイル使用メモリ | 82,456 KB |
| 実行使用メモリ | 87,072 KB |
| 最終ジャッジ日時 | 2024-07-17 18:15:55 |
| 合計ジャッジ時間 | 41,634 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 TLE * 10 |
ソースコード
"""
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))
SPD_9X2