結果

問題 No.1011 Infinite Stairs
ユーザー mkawa2mkawa2
提出日時 2020-03-20 21:57:43
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 734 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 1,050 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 259,464 KB
最終ジャッジ日時 2023-09-24 10:57:08
合計ジャッジ時間 6,632 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,184 KB
testcase_01 AC 72 ms
71,084 KB
testcase_02 AC 88 ms
75,920 KB
testcase_03 AC 508 ms
215,652 KB
testcase_04 AC 143 ms
76,708 KB
testcase_05 AC 734 ms
259,464 KB
testcase_06 AC 72 ms
71,468 KB
testcase_07 AC 81 ms
75,840 KB
testcase_08 AC 71 ms
71,228 KB
testcase_09 AC 75 ms
75,460 KB
testcase_10 AC 81 ms
75,664 KB
testcase_11 AC 153 ms
76,832 KB
testcase_12 AC 80 ms
75,824 KB
testcase_13 AC 124 ms
76,052 KB
testcase_14 AC 78 ms
75,836 KB
testcase_15 AC 137 ms
76,752 KB
testcase_16 AC 384 ms
173,288 KB
testcase_17 AC 100 ms
76,220 KB
testcase_18 AC 256 ms
132,248 KB
testcase_19 AC 81 ms
75,988 KB
testcase_20 AC 81 ms
76,084 KB
testcase_21 AC 149 ms
98,320 KB
testcase_22 AC 226 ms
122,048 KB
testcase_23 AC 165 ms
103,132 KB
testcase_24 AC 172 ms
105,432 KB
testcase_25 AC 230 ms
124,500 KB
testcase_26 AC 107 ms
75,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def MI(): return map(int, sys.stdin.readline().split())

def main():
    md=10**9+7
    n,d,k=MI()
    dp=[0]*(k+1)
    dp[0]=1
    for _ in range(n):
        s=0
        ndp = [0] * (k + 1)
        for i in range(1,k+1):
            s+=dp[i-1]
            if i-1-d>=0:s-=dp[i-1-d]
            s%=md
            ndp[i]=s
        dp=ndp
    print(dp[k])

main()
0