結果

問題 No.1973 Divisor Sequence
ユーザー titan23titan23
提出日時 2022-06-24 09:16:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 800 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 290,668 KB
最終ジャッジ日時 2024-04-25 15:27:47
合計ジャッジ時間 10,052 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
61,404 KB
testcase_01 AC 41 ms
55,068 KB
testcase_02 AC 491 ms
248,796 KB
testcase_03 AC 92 ms
84,236 KB
testcase_04 AC 317 ms
177,144 KB
testcase_05 AC 119 ms
99,240 KB
testcase_06 AC 330 ms
183,768 KB
testcase_07 AC 116 ms
93,216 KB
testcase_08 AC 214 ms
133,200 KB
testcase_09 AC 285 ms
164,028 KB
testcase_10 AC 368 ms
188,328 KB
testcase_11 AC 102 ms
87,444 KB
testcase_12 AC 282 ms
162,944 KB
testcase_13 AC 130 ms
99,800 KB
testcase_14 AC 299 ms
140,420 KB
testcase_15 AC 436 ms
226,484 KB
testcase_16 AC 422 ms
223,640 KB
testcase_17 AC 326 ms
169,808 KB
testcase_18 AC 95 ms
79,976 KB
testcase_19 AC 406 ms
199,416 KB
testcase_20 AC 122 ms
91,868 KB
testcase_21 AC 401 ms
207,952 KB
testcase_22 AC 367 ms
197,552 KB
testcase_23 TLE -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
mod = 1000000007

from collections import Counter
def factorization(n: int) -> Counter:
  ret = Counter()
  tmp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if tmp == 1:
      break
    if tmp % i == 0:
      cnt = 0
      while tmp % i == 0:
        cnt += 1
        tmp //= i
      ret[i] = cnt
  if tmp != 1:
    ret[tmp] = 1
  if ret == []:
    ret[n] = 1
  return ret

#  -----------------------  #

n, m = map(int, input().split())

ans = 1
for p,e in factorization(m).items():
  dp = [[0]*(e+1) for _ in range(n+1)]
  for i in range(e+1):
    dp[0][i] = 1
  for i in range(n):
    for j in range(e+1):
      for k in range(e-j+1):
        dp[i+1][j] += dp[i][k]
      dp[i+1][j] %= mod
  ans *= dp[-1][0]
  ans %= mod

print(ans)
0