結果

問題 No.1581 Multiple Sequence
ユーザー 👑 tamatotamato
提出日時 2021-07-02 22:14:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 87,756 KB
実行使用メモリ 101,060 KB
最終ジャッジ日時 2023-09-11 22:18:40
合計ジャッジ時間 6,026 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,568 KB
testcase_01 AC 71 ms
71,660 KB
testcase_02 AC 221 ms
97,620 KB
testcase_03 AC 235 ms
99,068 KB
testcase_04 AC 111 ms
82,808 KB
testcase_05 AC 242 ms
99,532 KB
testcase_06 AC 136 ms
85,872 KB
testcase_07 AC 111 ms
82,768 KB
testcase_08 AC 119 ms
84,020 KB
testcase_09 AC 228 ms
97,936 KB
testcase_10 AC 156 ms
86,996 KB
testcase_11 AC 92 ms
76,808 KB
testcase_12 AC 124 ms
84,932 KB
testcase_13 AC 85 ms
76,436 KB
testcase_14 AC 241 ms
98,980 KB
testcase_15 AC 180 ms
93,872 KB
testcase_16 AC 99 ms
80,600 KB
testcase_17 AC 248 ms
100,712 KB
testcase_18 AC 91 ms
76,848 KB
testcase_19 AC 215 ms
97,048 KB
testcase_20 AC 231 ms
97,752 KB
testcase_21 AC 232 ms
99,036 KB
testcase_22 AC 153 ms
86,528 KB
testcase_23 AC 267 ms
101,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    M = int(input())
    div = [[] for _ in range(M+1)]
    for i in range(1, M+1):
        for j in range(2, M+1):
            if i*j > M:
                break
            div[i*j].append(i)

    dp = [1] * (M+1)
    for i in range(1, M+1):
        for d in div[i]:
            dp[i] = (dp[i] + dp[(i - d) // d])%mod
    print(dp[M])


if __name__ == '__main__':
    main()
0