結果

問題 No.1011 Infinite Stairs
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-03-20 22:13:47
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 259,764 KB
最終ジャッジ日時 2023-09-24 10:59:00
合計ジャッジ時間 6,020 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,476 KB
testcase_01 AC 68 ms
71,352 KB
testcase_02 AC 87 ms
76,676 KB
testcase_03 AC 378 ms
217,056 KB
testcase_04 AC 118 ms
77,612 KB
testcase_05 AC 523 ms
259,764 KB
testcase_06 AC 65 ms
71,568 KB
testcase_07 AC 79 ms
76,352 KB
testcase_08 AC 68 ms
71,120 KB
testcase_09 AC 75 ms
76,696 KB
testcase_10 AC 80 ms
76,168 KB
testcase_11 AC 126 ms
77,644 KB
testcase_12 AC 77 ms
76,284 KB
testcase_13 AC 106 ms
77,068 KB
testcase_14 AC 78 ms
76,280 KB
testcase_15 AC 119 ms
77,620 KB
testcase_16 AC 296 ms
174,844 KB
testcase_17 AC 95 ms
76,800 KB
testcase_18 AC 212 ms
132,988 KB
testcase_19 AC 89 ms
76,160 KB
testcase_20 AC 84 ms
76,160 KB
testcase_21 AC 140 ms
99,308 KB
testcase_22 AC 197 ms
122,888 KB
testcase_23 AC 155 ms
104,124 KB
testcase_24 AC 149 ms
106,232 KB
testcase_25 AC 193 ms
125,536 KB
testcase_26 AC 101 ms
77,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, d, K = map(int, input().split())
mod = 10**9 + 7
dp = [0]*(K+2)
dp[0] = 1
for _ in range(N):
    dp2 = [0] * (K+2)
    for i in range(K, -1, -1):
        dp2[min(i+1, K+1)] += dp[i]
        dp2[min(i+d+1, K+1)] -= dp[i]
    for i in range(1, K+2):
        dp2[i] = (dp2[i] + dp2[i-1])%mod
    dp = dp2

print(dp2[K])
0