結果

問題 No.1659 Product of Divisors
ユーザー ntudantuda
提出日時 2021-08-29 15:19:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 76,716 KB
最終ジャッジ日時 2023-08-14 10:02:46
合計ジャッジ時間 5,031 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,472 KB
testcase_01 AC 104 ms
76,712 KB
testcase_02 AC 96 ms
71,264 KB
testcase_03 AC 97 ms
71,372 KB
testcase_04 AC 100 ms
71,484 KB
testcase_05 AC 99 ms
71,600 KB
testcase_06 AC 98 ms
71,524 KB
testcase_07 AC 103 ms
76,196 KB
testcase_08 AC 97 ms
71,380 KB
testcase_09 AC 99 ms
71,592 KB
testcase_10 AC 107 ms
76,412 KB
testcase_11 AC 98 ms
71,676 KB
testcase_12 AC 100 ms
71,512 KB
testcase_13 AC 98 ms
71,472 KB
testcase_14 AC 98 ms
71,512 KB
testcase_15 AC 104 ms
76,212 KB
testcase_16 AC 103 ms
76,436 KB
testcase_17 AC 99 ms
71,476 KB
testcase_18 AC 98 ms
71,300 KB
testcase_19 AC 99 ms
71,660 KB
testcase_20 AC 103 ms
76,580 KB
testcase_21 AC 102 ms
76,716 KB
testcase_22 AC 109 ms
76,332 KB
testcase_23 AC 100 ms
71,304 KB
testcase_24 AC 103 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
mod = 10 ** 9 + 7
N,K = map(int,input().split())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(N))

def comb(n, k):
    tmp = 1
    for i in range(k):
        tmp = (tmp * (n - i) * pow(i+1, mod-2, mod)) % mod
    return tmp

nc = len(c)
dp = [0] * len(c)

i = 0
for v in c.values():
    tmp = 0
    for j in range(v+1):
        tmp += comb(K+j-1,j) % mod 
        tmp %= mod
    dp[i] = tmp
    i += 1

ans = 1
for d in dp:
    ans *= d
    ans %= mod
print(ans)
0