結果

問題 No.1659 Product of Divisors
ユーザー 👑 timitimi
提出日時 2021-09-14 09:03:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 257,328 KB
最終ジャッジ日時 2023-09-09 04:24:56
合計ジャッジ時間 9,337 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 246 ms
256,872 KB
testcase_01 AC 246 ms
257,108 KB
testcase_02 WA -
testcase_03 AC 239 ms
256,896 KB
testcase_04 AC 260 ms
257,076 KB
testcase_05 AC 249 ms
256,856 KB
testcase_06 AC 246 ms
256,840 KB
testcase_07 AC 241 ms
257,052 KB
testcase_08 AC 262 ms
257,088 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
mod=10**9+7
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
n=10**6
inv_t=[0]+[1]
for i in range(2,n):
  inv_t+=[inv_t[mod%i]*(mod-int(mod/i))%mod]

kai=[1,1]
rev_kai=[1,inv_t[1]]
for i in range(2,n):
  kai.append(kai[-1]*i%mod)
  rev_kai.append(rev_kai[-1]*inv_t[i]%mod)

def cmb(n,r):
  return kai[n]*rev_kai[r]*rev_kai[n-r]%mod

A=factorization(N) 
#print(A)
ans=1
for a,b in A:
  cnt=0
  for i in range(b+1):
    cnt+=cmb(K-1+i,K-1)
  ans*=cnt
  ans%=mod
print(ans)
0