結果

問題 No.1973 Divisor Sequence
ユーザー とりゐとりゐ
提出日時 2022-06-10 22:10:54
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 706 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 75,740 KB
最終ジャッジ日時 2023-10-21 06:20:52
合計ジャッジ時間 6,701 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,600 KB
testcase_01 AC 41 ms
53,380 KB
testcase_02 AC 367 ms
75,588 KB
testcase_03 AC 87 ms
75,608 KB
testcase_04 AC 244 ms
75,576 KB
testcase_05 AC 103 ms
75,496 KB
testcase_06 AC 255 ms
75,576 KB
testcase_07 AC 101 ms
75,644 KB
testcase_08 AC 166 ms
75,568 KB
testcase_09 AC 217 ms
75,572 KB
testcase_10 AC 257 ms
75,492 KB
testcase_11 AC 91 ms
75,592 KB
testcase_12 AC 219 ms
75,572 KB
testcase_13 AC 106 ms
75,480 KB
testcase_14 AC 193 ms
75,604 KB
testcase_15 AC 322 ms
75,588 KB
testcase_16 AC 320 ms
75,580 KB
testcase_17 AC 230 ms
75,492 KB
testcase_18 AC 84 ms
75,732 KB
testcase_19 AC 296 ms
75,740 KB
testcase_20 AC 105 ms
75,556 KB
testcase_21 AC 302 ms
75,576 KB
testcase_22 AC 275 ms
75,576 KB
testcase_23 AC 508 ms
75,528 KB
testcase_24 AC 706 ms
75,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def fact(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

def calc(n,k):
  dp=[0]*(k+1)
  dp[0]=1
  for _ in range(n):
    dp_n=[0]*(k+1)
    cum=0
    for i in range(k+1):
      cum+=dp[i]
      dp_n[k-i]=cum
    dp=[i%mod for i in dp_n]
  return sum(dp)%mod 

mod=10**9+7
n,m=map(int,input().split())
ans=1
if m==1:
  print(1)
  exit()

f=fact(m)

for _,k in f:
  ans*=calc(n,k)
  ans%=mod

print(ans)
0