結果

問題 No.1011 Infinite Stairs
ユーザー nagitaosunagitaosu
提出日時 2020-03-20 22:25:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 288,012 KB
最終ジャッジ日時 2023-08-21 17:11:33
合計ジャッジ時間 5,405 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,236 KB
testcase_01 AC 70 ms
71,440 KB
testcase_02 AC 84 ms
76,560 KB
testcase_03 AC 421 ms
214,336 KB
testcase_04 AC 143 ms
92,904 KB
testcase_05 AC 590 ms
288,012 KB
testcase_06 WA -
testcase_07 AC 80 ms
76,180 KB
testcase_08 WA -
testcase_09 AC 75 ms
76,220 KB
testcase_10 AC 78 ms
76,240 KB
testcase_11 AC 143 ms
92,796 KB
testcase_12 AC 77 ms
76,080 KB
testcase_13 AC 122 ms
92,636 KB
testcase_14 AC 77 ms
76,272 KB
testcase_15 AC 134 ms
93,120 KB
testcase_16 AC 315 ms
172,876 KB
testcase_17 AC 92 ms
76,356 KB
testcase_18 AC 216 ms
131,576 KB
testcase_19 AC 80 ms
76,268 KB
testcase_20 AC 79 ms
76,080 KB
testcase_21 AC 132 ms
98,648 KB
testcase_22 AC 197 ms
121,664 KB
testcase_23 AC 146 ms
103,180 KB
testcase_24 AC 148 ms
105,512 KB
testcase_25 AC 197 ms
124,448 KB
testcase_26 AC 99 ms
76,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7

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

print(dp[-1][-1])
0