結果

問題 No.1581 Multiple Sequence
ユーザー flippergo
提出日時 2025-03-26 09:10:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,266 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 225,480 KB
最終ジャッジ日時 2025-03-26 09:10:28
合計ジャッジ時間 18,093 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)
M = int(input())
MOD = 10**9+7
memo = {}
def f(n):
    if n==0:
        return 1
    if n in memo:
        return memo[n]
    res = 0
    for i in range(1,n+1):
        if i*i>n:break
        if n%i==0:
            res = (res+f(n//i-1))%MOD
            if i*i<n:
                res = (res+f(i-1))%MOD
    memo[n] = res
    return memo[n]
print(f(M))
0