結果

問題 No.1659 Product of Divisors
ユーザー 👑 timitimi
提出日時 2021-09-14 09:41:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 899 bytes
コンパイル時間 1,279 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 257,828 KB
最終ジャッジ日時 2023-09-09 05:06:26
合計ジャッジ時間 8,618 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 271 ms
257,188 KB
testcase_01 AC 264 ms
257,284 KB
testcase_02 AC 75 ms
71,088 KB
testcase_03 AC 268 ms
256,788 KB
testcase_04 AC 278 ms
256,964 KB
testcase_05 AC 272 ms
257,020 KB
testcase_06 AC 269 ms
256,860 KB
testcase_07 AC 264 ms
257,080 KB
testcase_08 AC 275 ms
256,900 KB
testcase_09 AC 276 ms
257,036 KB
testcase_10 AC 278 ms
256,972 KB
testcase_11 AC 280 ms
257,388 KB
testcase_12 AC 282 ms
256,900 KB
testcase_13 AC 75 ms
71,348 KB
testcase_14 AC 282 ms
257,240 KB
testcase_15 AC 267 ms
256,836 KB
testcase_16 AC 268 ms
256,716 KB
testcase_17 AC 263 ms
256,756 KB
testcase_18 AC 263 ms
256,984 KB
testcase_19 AC 263 ms
256,644 KB
testcase_20 AC 273 ms
257,464 KB
testcase_21 AC 277 ms
257,828 KB
testcase_22 AC 278 ms
256,824 KB
testcase_23 AC 280 ms
256,960 KB
testcase_24 AC 273 ms
257,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
mod=10**9+7
if N==1:
  print(1)
  exit()
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=1
  d=1
  #素因数aをi回使い、分配するとき
  for i in range(1,b+1):
    d*=(K+i-1)
    d//=(i)
    cnt+=d
  ans*=cnt
  ans%=mod
print(ans)
0