結果
| 問題 |
No.1659 Product of Divisors
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:23:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 906 bytes |
| コンパイル時間 | 200 ms |
| コンパイル使用メモリ | 82,500 KB |
| 実行使用メモリ | 58,952 KB |
| 最終ジャッジ日時 | 2025-03-31 17:23:53 |
| 合計ジャッジ時間 | 2,134 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
mod = 10**9 + 7
def factorize(n):
factors = {}
while n % 2 == 0:
factors[2] = factors.get(2, 0) + 1
n = n // 2
i = 3
while i * i <= n:
while n % i == 0:
factors[i] = factors.get(i, 0) + 1
n = n // i
i += 2
if n > 1:
factors[n] = 1
return factors
max_fact = 40
fact = [1] * (max_fact + 1)
for i in range(1, max_fact + 1):
fact[i] = fact[i-1] * i % mod
N, K = map(int, input().split())
factors = factorize(N)
if not factors:
print(1)
else:
ans = 1
k_mod = K % mod
for e in factors.values():
product_part = 1
for j in range(1, e + 1):
term = (k_mod + j) % mod
product_part = product_part * term % mod
inv_fact_e = pow(fact[e], mod - 2, mod)
contribution = product_part * inv_fact_e % mod
ans = ans * contribution % mod
print(ans)
lam6er