結果

問題 No.1011 Infinite Stairs
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-30 23:45:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 527 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 249,896 KB
最終ジャッジ日時 2024-04-27 13:35:29
合計ジャッジ時間 4,427 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,068 KB
testcase_01 AC 39 ms
52,804 KB
testcase_02 AC 61 ms
67,500 KB
testcase_03 AC 368 ms
205,816 KB
testcase_04 AC 99 ms
76,212 KB
testcase_05 AC 527 ms
249,896 KB
testcase_06 AC 40 ms
53,512 KB
testcase_07 AC 57 ms
65,232 KB
testcase_08 AC 40 ms
53,876 KB
testcase_09 AC 47 ms
60,652 KB
testcase_10 AC 55 ms
64,312 KB
testcase_11 AC 105 ms
76,400 KB
testcase_12 AC 54 ms
63,588 KB
testcase_13 AC 87 ms
75,988 KB
testcase_14 AC 50 ms
61,044 KB
testcase_15 AC 97 ms
76,532 KB
testcase_16 AC 270 ms
163,268 KB
testcase_17 AC 71 ms
72,756 KB
testcase_18 AC 176 ms
120,412 KB
testcase_19 AC 55 ms
64,664 KB
testcase_20 AC 49 ms
62,480 KB
testcase_21 AC 104 ms
86,684 KB
testcase_22 AC 157 ms
112,240 KB
testcase_23 AC 114 ms
91,508 KB
testcase_24 AC 118 ms
94,160 KB
testcase_25 AC 162 ms
113,724 KB
testcase_26 AC 71 ms
74,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,k = map(int,input().split())
mod = 10**9+7

dp = [0]*(k+2)
dp[0] = 1
for i in range(n):
    ndp = [0]*(k+2)
    for j in range(k+1):
        if j:
            dp[j] += dp[j-1]
            dp[j] %= mod
        ndp[j+1] += dp[j]
        ndp[j+1] %= mod
        ndp[min(k+1,j+d+1)] -= dp[j]
        ndp[min(k+1,j+d+1)] %= mod
    dp = ndp
print(dp[k])
0