結果

問題 No.1659 Product of Divisors
ユーザー NatsubiSogan
提出日時 2021-08-27 22:44:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 60,324 KB
最終ジャッジ日時 2024-11-21 03:54:34
合計ジャッジ時間 2,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


def prime_factorize(n: int) -> list:
    res = []

    while n % 2 == 0:
        res.append(2)
        n //= 2

    f = 3

    while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2

    if n != 1:
        res.append(n)

    return res

mod = 10 ** 9 + 7

def comb(n, k):
    res = 1
    for i in range(k):
        res *= n - i
        res //= i + 1
    return res % mod
n, k = map(int, input().split())
c = Counter(prime_factorize(n))
ans = 1
for _, v in c.items():
    ans *= comb(k + v, v)
    ans %= mod
print(ans)
0