結果

問題 No.1659 Product of Divisors
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-08-27 22:01:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 76,116 KB
最終ジャッジ日時 2023-08-13 08:57:20
合計ジャッジ時間 3,808 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,392 KB
testcase_01 AC 82 ms
75,904 KB
testcase_02 AC 74 ms
71,356 KB
testcase_03 AC 74 ms
71,508 KB
testcase_04 AC 88 ms
75,988 KB
testcase_05 AC 84 ms
75,916 KB
testcase_06 AC 78 ms
75,668 KB
testcase_07 AC 81 ms
75,864 KB
testcase_08 AC 96 ms
75,992 KB
testcase_09 AC 96 ms
75,996 KB
testcase_10 AC 95 ms
75,792 KB
testcase_11 AC 97 ms
76,116 KB
testcase_12 AC 95 ms
75,876 KB
testcase_13 AC 75 ms
71,248 KB
testcase_14 AC 95 ms
75,816 KB
testcase_15 AC 78 ms
76,016 KB
testcase_16 AC 79 ms
75,900 KB
testcase_17 AC 78 ms
76,012 KB
testcase_18 AC 79 ms
76,016 KB
testcase_19 AC 77 ms
76,040 KB
testcase_20 AC 87 ms
75,996 KB
testcase_21 AC 90 ms
76,092 KB
testcase_22 AC 87 ms
75,844 KB
testcase_23 AC 92 ms
75,884 KB
testcase_24 AC 85 ms
75,904 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