結果
| 問題 |
No.1611 Minimum Multiple with Double Divisors
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-31 01:06:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 560 ms / 2,000 ms |
| コード長 | 1,108 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 82,668 KB |
| 実行使用メモリ | 78,296 KB |
| 最終ジャッジ日時 | 2024-10-07 04:50:25 |
| 合計ジャッジ時間 | 12,210 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 37 |
ソースコード
from collections import defaultdict
def prime_factorization(n):
prime_cnt_dict = defaultdict(int)
if n == 0 or n == 1:
return prime_cnt_dict
nc = n
while nc % 2 == 0:
nc //= 2
prime_cnt_dict[2] += 1
f = 3
while f * f <= n:
cnt = 0
while nc % f == 0:
nc //= f
prime_cnt_dict[f] += 1
f += 2
if nc != 1:
prime_cnt_dict[nc] = 1
return prime_cnt_dict
Prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
PrimeCountList = [prime_factorization(i) for i in range(32)]
t = int(input())
for _ in range(t):
x = int(input())
x_prime_cnt_dict = defaultdict(int)
for prime in Prime:
xc = x
while xc % prime == 0:
xc //= prime
x_prime_cnt_dict[prime] += 1
for i in range(2, 32):
x_cnt = 1
x_i_cnt = 1
for prime in PrimeCountList[i]:
x_cnt *= x_prime_cnt_dict[prime] + 1
x_i_cnt *= x_prime_cnt_dict[prime] + PrimeCountList[i][prime] + 1
if 2 * x_cnt == x_i_cnt:
break
print(x * i)