結果

問題 No.1011 Infinite Stairs
ユーザー qibqib
提出日時 2022-11-10 17:14:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 815 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 1,099 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 260,380 KB
最終ジャッジ日時 2023-10-01 01:31:48
合計ジャッジ時間 7,963 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,348 KB
testcase_01 AC 72 ms
71,352 KB
testcase_02 AC 105 ms
76,528 KB
testcase_03 AC 606 ms
260,380 KB
testcase_04 AC 160 ms
77,644 KB
testcase_05 AC 815 ms
259,692 KB
testcase_06 AC 70 ms
71,328 KB
testcase_07 AC 88 ms
76,372 KB
testcase_08 AC 71 ms
71,460 KB
testcase_09 AC 77 ms
76,168 KB
testcase_10 AC 87 ms
76,216 KB
testcase_11 AC 158 ms
78,644 KB
testcase_12 AC 87 ms
76,304 KB
testcase_13 AC 128 ms
77,648 KB
testcase_14 AC 80 ms
76,156 KB
testcase_15 AC 143 ms
78,004 KB
testcase_16 AC 431 ms
260,016 KB
testcase_17 AC 110 ms
76,972 KB
testcase_18 AC 287 ms
188,428 KB
testcase_19 AC 86 ms
76,388 KB
testcase_20 AC 80 ms
76,232 KB
testcase_21 AC 167 ms
121,704 KB
testcase_22 AC 253 ms
168,012 KB
testcase_23 AC 180 ms
130,616 KB
testcase_24 AC 190 ms
135,356 KB
testcase_25 AC 281 ms
173,880 KB
testcase_26 AC 107 ms
77,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

n, d, k = map(int, input().split())
dp = [0 for _ in range(k + 1)]
dp[0] = 1
for _ in range(n):
  ndp = [0 for _ in range(k + 1)]
  s = [0 for _ in range(k + 1)]
  for i in range(k + 1):
    s[i] = (s[i - 1] + dp[i]) % MOD
  for i in range(1, k + 1):
    if i - d - 1 >= 0:
      ndp[i] = (s[i - 1] - s[i - d - 1]) % MOD
    else:
      ndp[i] = s[i - 1]
  dp = ndp

print(dp[k])
0