結果
| 問題 | No.1611 Minimum Multiple with Double Divisors |
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-08-13 19:37:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,508 ms / 2,000 ms |
| コード長 | 1,578 bytes |
| 記録 | |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 76,708 KB |
| 最終ジャッジ日時 | 2024-11-21 15:28:11 |
| 合計ジャッジ時間 | 17,019 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 37 |
ソースコード
# Xを素因数分解
# 既存素因数のべき乗を倍にするか、ない素因数を加える
# 10**11ということは37までに存在しない素因数があるはず
# 2*3*5*7*11*13*17*19*23*29*31*37 = 7*10**12
# 必要なのは37までの素因数だけ
# WAだった、2の乗数と3の乗数が両方増えるというパターンがある
# 素因数で考えると、そのコンビネーションもあるから難しい
# 発想の転換、multiplierは37までのどれかの数字にあると考えればいい
# 37超の素因数は無視する
# TLEしたので、素因数のべき乗数のリストをコピーして使う
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
def low_prime_div_count(num):
count = [0]*13
div_count = 1
for i in range(13):
p = primes[i]
c = 0
while num%p == 0:
num //= p
c += 1
count[i] = c
div_count *= (c+1)
return div_count, count
T = int(input())
for t in range(T):
X = int(input())
base, count = low_prime_div_count(X)
#print('base', base, 'count', count)
for n in range(2, 38):
temp_count = count.copy()
div_temp = 1
n_ = n
for i in range(13):
p = primes[i]
c = 0
while n_%p == 0:
n_ //= p
c += 1
temp_count[i] += c
div_temp *= (temp_count[i]+1)
#print('n', n, 'temp_count', temp_count, 'div_temp', div_temp)
if div_temp == base*2:
print(X*n)
break
FromBooska