結果

問題 No.1011 Infinite Stairs
ユーザー amyuamyu
提出日時 2020-03-20 22:13:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 1,142 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 77,412 KB
最終ジャッジ日時 2023-09-24 10:58:43
合計ジャッジ時間 4,421 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,288 KB
testcase_01 AC 71 ms
71,256 KB
testcase_02 AC 86 ms
76,244 KB
testcase_03 AC 220 ms
76,932 KB
testcase_04 AC 112 ms
76,560 KB
testcase_05 AC 295 ms
77,412 KB
testcase_06 AC 70 ms
71,208 KB
testcase_07 AC 84 ms
76,224 KB
testcase_08 AC 70 ms
71,416 KB
testcase_09 AC 76 ms
76,032 KB
testcase_10 AC 80 ms
76,220 KB
testcase_11 AC 112 ms
76,244 KB
testcase_12 AC 81 ms
76,160 KB
testcase_13 AC 98 ms
75,940 KB
testcase_14 AC 80 ms
76,280 KB
testcase_15 AC 106 ms
76,668 KB
testcase_16 AC 179 ms
77,008 KB
testcase_17 AC 93 ms
76,464 KB
testcase_18 AC 140 ms
76,508 KB
testcase_19 AC 83 ms
76,228 KB
testcase_20 AC 79 ms
76,112 KB
testcase_21 AC 105 ms
76,392 KB
testcase_22 AC 132 ms
76,776 KB
testcase_23 AC 110 ms
76,380 KB
testcase_24 AC 113 ms
76,412 KB
testcase_25 AC 133 ms
76,768 KB
testcase_26 AC 91 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,k=map(int,input().split())
mod=10**9+7
dp=[0]*(k+1)
dp[0]=1
for j in range(n):
    t=0
    for i in dp[max(0,k-d):k]:
        t+=i
        t%=mod
    for i in range(k,-1,-1):
        dp[i]=t
        t-=dp[i-1]
        if i-1-d>=0:
            t+=dp[i-1-d]
        t%=mod
print(dp[-1])
0