結果

問題 No.1973 Divisor Sequence
ユーザー とりゐとりゐ
提出日時 2022-06-10 22:09:12
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 652 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 79,832 KB
最終ジャッジ日時 2023-10-21 05:15:46
合計ジャッジ時間 9,658 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,712 KB
testcase_01 AC 35 ms
53,484 KB
testcase_02 AC 361 ms
75,928 KB
testcase_03 AC 83 ms
75,880 KB
testcase_04 AC 251 ms
75,920 KB
testcase_05 AC 104 ms
75,628 KB
testcase_06 AC 247 ms
75,896 KB
testcase_07 AC 104 ms
75,880 KB
testcase_08 AC 174 ms
75,888 KB
testcase_09 AC 228 ms
75,896 KB
testcase_10 AC 292 ms
75,808 KB
testcase_11 AC 97 ms
75,880 KB
testcase_12 AC 206 ms
75,896 KB
testcase_13 AC 106 ms
75,800 KB
testcase_14 AC 319 ms
75,888 KB
testcase_15 AC 328 ms
75,904 KB
testcase_16 AC 330 ms
75,904 KB
testcase_17 AC 249 ms
75,808 KB
testcase_18 AC 87 ms
75,792 KB
testcase_19 AC 312 ms
75,932 KB
testcase_20 AC 115 ms
75,860 KB
testcase_21 AC 318 ms
75,900 KB
testcase_22 AC 284 ms
75,900 KB
testcase_23 TLE -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

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)
    for i in range(k+1):
      for j in range(k+1):
        if i+j<=k:
          dp_n[j]+=dp[i]
    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