結果

問題 No.1659 Product of Divisors
ユーザー MineMine
提出日時 2021-09-09 19:31:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 8,912 KB
最終ジャッジ日時 2023-08-29 23:58:27
合計ジャッジ時間 3,039 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,796 KB
testcase_01 AC 21 ms
8,856 KB
testcase_02 AC 19 ms
8,596 KB
testcase_03 AC 18 ms
8,788 KB
testcase_04 AC 59 ms
8,728 KB
testcase_05 AC 43 ms
8,800 KB
testcase_06 AC 21 ms
8,720 KB
testcase_07 AC 21 ms
8,720 KB
testcase_08 AC 72 ms
8,744 KB
testcase_09 AC 72 ms
8,868 KB
testcase_10 AC 99 ms
8,904 KB
testcase_11 AC 72 ms
8,856 KB
testcase_12 AC 71 ms
8,748 KB
testcase_13 AC 19 ms
8,500 KB
testcase_14 AC 71 ms
8,852 KB
testcase_15 AC 21 ms
8,848 KB
testcase_16 AC 20 ms
8,768 KB
testcase_17 AC 20 ms
8,912 KB
testcase_18 AC 21 ms
8,896 KB
testcase_19 AC 19 ms
8,792 KB
testcase_20 AC 52 ms
8,792 KB
testcase_21 AC 82 ms
8,856 KB
testcase_22 AC 77 ms
8,840 KB
testcase_23 AC 66 ms
8,776 KB
testcase_24 AC 54 ms
8,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n, k = map(int, input().split())
mod = 10**9+7

def prime_factorization(n):
    arr = defaultdict(int)
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            arr[i] += 1
            n //= i
    if n != 1:
        arr[n] += 1
    return arr

def comb(n, r, mod=10**9+7):
    ans = 1
    for i in range(1, r+1):
        ans *= (n-i+1)*pow(i, mod-2, mod)
        ans %= mod
    return ans

arr = prime_factorization(n)
ans = 1
for i, m in arr.items():
    ans *= comb(k+m, m)
    ans %= mod
print(ans)


0