結果

問題 No.1581 Multiple Sequence
ユーザー shotoyooshotoyoo
提出日時 2021-07-02 22:20:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 86,552 KB
実行使用メモリ 78,120 KB
最終ジャッジ日時 2023-09-11 22:26:15
合計ジャッジ時間 8,603 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,460 KB
testcase_01 AC 73 ms
71,428 KB
testcase_02 AC 428 ms
77,944 KB
testcase_03 AC 460 ms
78,120 KB
testcase_04 AC 176 ms
77,652 KB
testcase_05 AC 481 ms
78,068 KB
testcase_06 AC 247 ms
77,860 KB
testcase_07 AC 168 ms
77,680 KB
testcase_08 AC 206 ms
77,640 KB
testcase_09 AC 436 ms
78,032 KB
testcase_10 AC 303 ms
77,740 KB
testcase_11 AC 126 ms
77,432 KB
testcase_12 AC 218 ms
77,596 KB
testcase_13 AC 88 ms
76,716 KB
testcase_14 AC 460 ms
78,076 KB
testcase_15 AC 345 ms
77,888 KB
testcase_16 AC 135 ms
77,532 KB
testcase_17 AC 508 ms
78,052 KB
testcase_18 AC 116 ms
77,292 KB
testcase_19 AC 407 ms
78,052 KB
testcase_20 AC 426 ms
77,952 KB
testcase_21 AC 458 ms
78,088 KB
testcase_22 AC 282 ms
77,904 KB
testcase_23 AC 524 ms
78,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))

### 約数列挙
def fs(n):
    s = set()
    for i in range(1,int(n**0.5)+2):
        if n%i==0:
            s.add(i)
            s.add(n//i)
    l = sorted(list(s))
    return l

m = int(input())
M = 10**9+7
dp = [0]*(m+1)
dp[0] = 1
for s in range(1,m+1):
    val = 0
    for f in fs(s):
        val += dp[(s-f)//f]
        val %= M
    dp[s] = val
ans = dp[m]
print(ans%M)
0