結果

問題 No.1581 Multiple Sequence
ユーザー 👑 rin204rin204
提出日時 2022-02-24 01:24:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,308 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 1,944 ms
コンパイル使用メモリ 86,404 KB
実行使用メモリ 231,016 KB
最終ジャッジ日時 2023-09-14 18:23:26
合計ジャッジ時間 20,350 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,464 KB
testcase_01 AC 74 ms
71,452 KB
testcase_02 AC 1,090 ms
206,036 KB
testcase_03 AC 1,154 ms
217,208 KB
testcase_04 AC 404 ms
124,152 KB
testcase_05 AC 1,230 ms
223,156 KB
testcase_06 AC 608 ms
151,788 KB
testcase_07 AC 381 ms
122,372 KB
testcase_08 AC 487 ms
135,152 KB
testcase_09 AC 1,107 ms
211,448 KB
testcase_10 AC 770 ms
170,696 KB
testcase_11 AC 241 ms
100,884 KB
testcase_12 AC 520 ms
140,512 KB
testcase_13 AC 110 ms
80,436 KB
testcase_14 AC 1,175 ms
217,840 KB
testcase_15 AC 873 ms
185,312 KB
testcase_16 AC 274 ms
107,620 KB
testcase_17 AC 1,278 ms
228,720 KB
testcase_18 AC 215 ms
97,808 KB
testcase_19 AC 1,028 ms
201,384 KB
testcase_20 AC 1,104 ms
207,096 KB
testcase_21 AC 1,159 ms
218,196 KB
testcase_22 AC 696 ms
162,708 KB
testcase_23 AC 1,308 ms
231,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

memo = {}
def dfs(m):
    if m == 0:
        return 1
    if m in memo:
        return memo[m]
        
    ret = 0
    for i in range(1, int(m ** 0.5 + 1)):
        if m % i == 0:
            ret += dfs(m // i - 1)
            if i != m // i:
                ret += dfs(i - 1)
            ret %= MOD
    memo[m] = ret
    return ret
    
m = int(input())        
print(dfs(m))
0