結果
| 問題 | No.1611 Minimum Multiple with Double Divisors |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-21 22:00:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,146 bytes |
| 記録 | |
| コンパイル時間 | 279 ms |
| コンパイル使用メモリ | 82,028 KB |
| 実行使用メモリ | 91,016 KB |
| 最終ジャッジ日時 | 2024-07-17 18:24:22 |
| 合計ジャッジ時間 | 6,967 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 36 |
ソースコード
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)