結果

問題 No.1011 Infinite Stairs
ユーザー nagitaosunagitaosu
提出日時 2020-03-20 22:25:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 828 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 269,696 KB
最終ジャッジ日時 2024-05-08 22:41:47
合計ジャッジ時間 4,504 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,712 KB
testcase_01 AC 43 ms
52,096 KB
testcase_02 AC 58 ms
63,360 KB
testcase_03 AC 410 ms
199,296 KB
testcase_04 AC 117 ms
93,476 KB
testcase_05 AC 593 ms
269,696 KB
testcase_06 WA -
testcase_07 AC 62 ms
61,824 KB
testcase_08 WA -
testcase_09 AC 47 ms
59,008 KB
testcase_10 AC 53 ms
61,312 KB
testcase_11 AC 131 ms
93,400 KB
testcase_12 AC 51 ms
60,928 KB
testcase_13 AC 111 ms
92,800 KB
testcase_14 AC 50 ms
60,588 KB
testcase_15 AC 120 ms
93,168 KB
testcase_16 AC 294 ms
157,824 KB
testcase_17 AC 71 ms
68,732 KB
testcase_18 AC 192 ms
116,096 KB
testcase_19 AC 50 ms
61,436 KB
testcase_20 AC 51 ms
60,672 KB
testcase_21 AC 106 ms
82,688 KB
testcase_22 AC 165 ms
106,752 KB
testcase_23 AC 119 ms
87,632 KB
testcase_24 AC 124 ms
89,600 KB
testcase_25 AC 173 ms
109,184 KB
testcase_26 AC 72 ms
69,992 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