結果

問題 No.1973 Divisor Sequence
コンテスト
ユーザー gr1msl3y
提出日時 2022-06-11 10:05:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 556 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 358 ms
コンパイル使用メモリ 84,992 KB
実行使用メモリ 81,280 KB
最終ジャッジ日時 2026-04-10 00:28:52
合計ジャッジ時間 3,034 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M = map(int, input().split())
if M == 1:
    print(1)
    exit()
MOD = 10**9+7

fact = []
v = M
for i in range(2, int(M**0.5)+1):
    if v % i:
        continue
    ct = 0
    while v % i == 0:
        v //= i
        ct += 1
    fact.append([i, ct])
if v > 1:
    fact.append([v, 1])


def solve(p, K):
    dp = [1]*(K+1)
    for _ in range(N-1):
        for i in range(K):
            dp[i+1] += dp[i]
            dp[i] %= MOD
        dp = dp[::-1]
    return sum(dp) % MOD


ans = 1
for p, c in fact:
    ans *= solve(p, c)
    ans %= MOD
print(ans)
0