結果

問題 No.1659 Product of Divisors
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-08-27 22:44:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 76,692 KB
最終ジャッジ日時 2023-08-13 10:01:41
合計ジャッジ時間 4,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,684 KB
testcase_01 AC 97 ms
76,416 KB
testcase_02 AC 90 ms
71,748 KB
testcase_03 AC 92 ms
71,568 KB
testcase_04 AC 91 ms
71,808 KB
testcase_05 AC 93 ms
71,692 KB
testcase_06 AC 92 ms
71,520 KB
testcase_07 AC 97 ms
76,500 KB
testcase_08 AC 92 ms
71,512 KB
testcase_09 AC 91 ms
71,432 KB
testcase_10 AC 102 ms
76,692 KB
testcase_11 AC 95 ms
71,524 KB
testcase_12 AC 94 ms
71,456 KB
testcase_13 AC 92 ms
71,488 KB
testcase_14 AC 92 ms
71,528 KB
testcase_15 AC 100 ms
76,336 KB
testcase_16 AC 98 ms
76,540 KB
testcase_17 AC 93 ms
71,688 KB
testcase_18 AC 92 ms
71,460 KB
testcase_19 AC 93 ms
71,728 KB
testcase_20 AC 97 ms
76,676 KB
testcase_21 AC 99 ms
76,692 KB
testcase_22 AC 104 ms
76,584 KB
testcase_23 AC 93 ms
71,500 KB
testcase_24 AC 99 ms
76,428 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