結果

問題 No.1659 Product of Divisors
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-08-27 22:44:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 60,924 KB
最終ジャッジ日時 2024-05-01 03:29:25
合計ジャッジ時間 1,930 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
54,716 KB
testcase_01 AC 43 ms
59,700 KB
testcase_02 AC 36 ms
54,676 KB
testcase_03 AC 38 ms
54,220 KB
testcase_04 AC 38 ms
54,060 KB
testcase_05 AC 38 ms
54,152 KB
testcase_06 AC 39 ms
54,220 KB
testcase_07 AC 41 ms
60,516 KB
testcase_08 AC 39 ms
54,608 KB
testcase_09 AC 37 ms
54,064 KB
testcase_10 AC 45 ms
59,352 KB
testcase_11 AC 39 ms
54,748 KB
testcase_12 AC 39 ms
54,528 KB
testcase_13 AC 38 ms
53,932 KB
testcase_14 AC 38 ms
54,972 KB
testcase_15 AC 41 ms
59,880 KB
testcase_16 AC 43 ms
60,924 KB
testcase_17 AC 39 ms
55,412 KB
testcase_18 AC 39 ms
54,220 KB
testcase_19 AC 39 ms
54,212 KB
testcase_20 AC 40 ms
59,160 KB
testcase_21 AC 41 ms
60,496 KB
testcase_22 AC 44 ms
59,024 KB
testcase_23 AC 38 ms
54,380 KB
testcase_24 AC 41 ms
59,824 KB
権限があれば一括ダウンロードができます

ソースコード

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