結果

問題 No.1659 Product of Divisors
ユーザー brthyyjpbrthyyjp
提出日時 2021-08-29 12:34:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 59,336 KB
最終ジャッジ日時 2024-05-01 21:57:48
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,160 KB
testcase_01 AC 43 ms
57,184 KB
testcase_02 WA -
testcase_03 AC 36 ms
53,004 KB
testcase_04 AC 48 ms
57,692 KB
testcase_05 AC 45 ms
57,572 KB
testcase_06 AC 39 ms
58,252 KB
testcase_07 AC 38 ms
58,732 KB
testcase_08 AC 53 ms
58,792 KB
testcase_09 AC 53 ms
57,896 KB
testcase_10 AC 53 ms
58,056 KB
testcase_11 AC 50 ms
59,040 KB
testcase_12 AC 51 ms
58,136 KB
testcase_13 WA -
testcase_14 AC 52 ms
59,268 KB
testcase_15 AC 39 ms
58,800 KB
testcase_16 AC 37 ms
57,928 KB
testcase_17 AC 37 ms
58,312 KB
testcase_18 AC 38 ms
58,400 KB
testcase_19 AC 39 ms
58,156 KB
testcase_20 AC 44 ms
58,868 KB
testcase_21 AC 47 ms
57,876 KB
testcase_22 AC 47 ms
57,740 KB
testcase_23 AC 48 ms
59,336 KB
testcase_24 AC 47 ms
57,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

def cmb2(n, r, mod):
    res = 1
    temp = 1
    for k in range(1, r+1):
        res *= (n-k+1)
        temp *= k
        res %= mod
        temp %= mod
    res *= pow(temp,(mod-2),mod)
    res %= mod
    return res

n, k = map(int, input().split())
mod = 10**9+7
D = factorize(n)
ans = 1
for p, q in D.items():
    ans *= cmb2(q+k, q, mod)
    ans %= mod
print(ans)
0