結果

問題 No.1011 Infinite Stairs
ユーザー ttrttr
提出日時 2020-05-24 22:14:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 760 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 288,968 KB
最終ジャッジ日時 2023-09-24 11:15:38
合計ジャッジ時間 6,449 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,448 KB
testcase_01 AC 71 ms
71,504 KB
testcase_02 AC 94 ms
76,640 KB
testcase_03 AC 534 ms
216,160 KB
testcase_04 AC 181 ms
93,136 KB
testcase_05 AC 760 ms
288,968 KB
testcase_06 AC 71 ms
71,388 KB
testcase_07 AC 91 ms
76,264 KB
testcase_08 AC 71 ms
71,072 KB
testcase_09 AC 80 ms
76,192 KB
testcase_10 AC 87 ms
76,296 KB
testcase_11 AC 190 ms
93,388 KB
testcase_12 AC 87 ms
76,436 KB
testcase_13 AC 152 ms
92,916 KB
testcase_14 AC 80 ms
76,304 KB
testcase_15 AC 163 ms
93,188 KB
testcase_16 AC 426 ms
173,888 KB
testcase_17 AC 115 ms
76,636 KB
testcase_18 AC 270 ms
132,432 KB
testcase_19 AC 87 ms
76,412 KB
testcase_20 AC 83 ms
76,384 KB
testcase_21 AC 165 ms
99,096 KB
testcase_22 AC 264 ms
122,508 KB
testcase_23 AC 178 ms
103,744 KB
testcase_24 AC 180 ms
106,048 KB
testcase_25 AC 252 ms
124,900 KB
testcase_26 AC 122 ms
86,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[0]*(K+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(K):
        if dp[i][j] == 0:
            continue
        dp[i+1][j+1] += dp[i][j]
        if j+d < K:
            dp[i+1][j+d+1] -= dp[i][j]
    for j in range(K):
        dp[i+1][j+1] += dp[i+1][j]
        dp[i+1][j+1] %= mod
print(dp[N][K])
0