結果

問題 No.1011 Infinite Stairs
ユーザー s_shoheis_shohei
提出日時 2020-06-14 14:44:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 895 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 442,960 KB
最終ジャッジ日時 2023-09-24 11:18:13
合計ジャッジ時間 6,799 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,372 KB
testcase_01 AC 72 ms
71,332 KB
testcase_02 AC 96 ms
76,724 KB
testcase_03 AC 621 ms
268,072 KB
testcase_04 AC 181 ms
108,152 KB
testcase_05 AC 895 ms
442,960 KB
testcase_06 AC 71 ms
71,436 KB
testcase_07 AC 88 ms
76,344 KB
testcase_08 AC 69 ms
71,408 KB
testcase_09 AC 79 ms
76,436 KB
testcase_10 AC 87 ms
76,432 KB
testcase_11 AC 206 ms
130,096 KB
testcase_12 AC 86 ms
76,420 KB
testcase_13 AC 159 ms
108,044 KB
testcase_14 AC 82 ms
76,176 KB
testcase_15 AC 173 ms
108,876 KB
testcase_16 AC 452 ms
260,240 KB
testcase_17 AC 118 ms
85,452 KB
testcase_18 AC 295 ms
188,552 KB
testcase_19 AC 87 ms
76,440 KB
testcase_20 AC 82 ms
76,292 KB
testcase_21 AC 172 ms
122,180 KB
testcase_22 AC 269 ms
168,744 KB
testcase_23 AC 197 ms
131,576 KB
testcase_24 AC 202 ms
135,920 KB
testcase_25 AC 270 ms
173,668 KB
testcase_26 AC 119 ms
86,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,k = map(int, input().split())
dp = [[0 for _ in range(k+5)] for _ in range(n+1)]
dp[0][0]=1
mod=10**9+7
for i in range(n):
    imos=[0]*(k+5)
    for j in range(k):
        imos[j+1]+=dp[i][j]
        mxind = min(j+d+1,k+4)
        imos[mxind]-=dp[i][j]

    for j in range(len(imos)-1):
        imos[j+1]+=imos[j]
        imos[j+1]%=mod
    dp[i+1]=imos

print(dp[-1][k]%mod)
0