結果

問題 No.1011 Infinite Stairs
ユーザー O2MTO2MT
提出日時 2021-06-07 18:51:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 593 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 259,948 KB
最終ジャッジ日時 2023-09-24 11:24:55
合計ジャッジ時間 5,651 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,360 KB
testcase_01 AC 73 ms
71,292 KB
testcase_02 AC 97 ms
76,388 KB
testcase_03 AC 426 ms
216,840 KB
testcase_04 AC 136 ms
77,060 KB
testcase_05 AC 593 ms
259,948 KB
testcase_06 AC 73 ms
71,312 KB
testcase_07 AC 89 ms
76,400 KB
testcase_08 AC 72 ms
71,540 KB
testcase_09 AC 78 ms
76,188 KB
testcase_10 AC 88 ms
76,368 KB
testcase_11 AC 141 ms
77,504 KB
testcase_12 AC 88 ms
76,084 KB
testcase_13 AC 120 ms
77,048 KB
testcase_14 AC 83 ms
76,312 KB
testcase_15 AC 136 ms
77,368 KB
testcase_16 AC 324 ms
174,060 KB
testcase_17 AC 107 ms
77,328 KB
testcase_18 AC 221 ms
132,952 KB
testcase_19 AC 87 ms
76,328 KB
testcase_20 AC 82 ms
76,280 KB
testcase_21 AC 140 ms
99,032 KB
testcase_22 AC 200 ms
122,644 KB
testcase_23 AC 150 ms
103,552 KB
testcase_24 AC 154 ms
105,880 KB
testcase_25 AC 205 ms
125,120 KB
testcase_26 AC 104 ms
77,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D,K = map(int,input().split())
MOD = 10**9+7
dp = [0 for _ in range(K+1)]
dp[0] = 1
for i in range(N):
  S = [0 for _ in range(K+1)]
  for j in range(K):
    S[j+1] = (S[j]+dp[j])%MOD
  for j in range(K,-1,-1):
    dp[j] = (S[j]-S[max(0,j-D)])%MOD
print(dp[K])
0