結果

問題 No.1659 Product of Divisors
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-08-27 22:01:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 58,624 KB
最終ジャッジ日時 2024-05-01 02:33:46
合計ジャッジ時間 2,367 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 AC 41 ms
57,984 KB
testcase_02 AC 36 ms
52,352 KB
testcase_03 AC 37 ms
52,480 KB
testcase_04 AC 53 ms
58,240 KB
testcase_05 AC 48 ms
58,240 KB
testcase_06 AC 45 ms
58,368 KB
testcase_07 AC 42 ms
57,984 KB
testcase_08 AC 56 ms
57,728 KB
testcase_09 AC 56 ms
58,240 KB
testcase_10 AC 56 ms
58,240 KB
testcase_11 AC 57 ms
58,368 KB
testcase_12 AC 56 ms
57,600 KB
testcase_13 AC 40 ms
52,608 KB
testcase_14 AC 57 ms
58,240 KB
testcase_15 AC 43 ms
58,368 KB
testcase_16 AC 42 ms
57,984 KB
testcase_17 AC 41 ms
58,240 KB
testcase_18 AC 41 ms
57,984 KB
testcase_19 AC 40 ms
58,240 KB
testcase_20 AC 49 ms
57,600 KB
testcase_21 AC 52 ms
57,728 KB
testcase_22 AC 50 ms
57,984 KB
testcase_23 AC 54 ms
58,624 KB
testcase_24 AC 48 ms
57,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from _collections import defaultdict
n,k=map(int,input().split())

dic=defaultdict(int)
p=2

nod=n
while p**2<=n:
    if nod%p==0:
        dic[p]+=1
        nod//=p
    else:
        p+=1
if nod>1:dic[nod]+=1


ans=1
mod=10**9+7

def cnb(n,r):
    if n<0 or r<0 or r>n:
        return 0
    res=1
    res2=1
    for i in range(1,r+1):
        res*=n-i+1
        res%=mod
        res2*=i
        res2%=mod
    ans=res*pow(res2,mod-2,mod)
    ans%=mod
    return ans

for p in dic:
    subans=0
    for a in range(dic[p]+1):
        subans+=cnb(k-1+a,a)
        subans%=mod
    ans*=subans
    ans%=mod

print(ans)

0