結果

問題 No.1011 Infinite Stairs
ユーザー roarisroaris
提出日時 2020-06-27 20:46:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 974 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 407,200 KB
最終ジャッジ日時 2024-07-17 12:10:58
合計ジャッジ時間 6,066 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,880 KB
testcase_01 AC 37 ms
53,636 KB
testcase_02 AC 68 ms
78,696 KB
testcase_03 AC 633 ms
260,720 KB
testcase_04 AC 147 ms
100,272 KB
testcase_05 AC 974 ms
407,200 KB
testcase_06 AC 36 ms
52,568 KB
testcase_07 AC 60 ms
76,780 KB
testcase_08 AC 37 ms
52,748 KB
testcase_09 AC 44 ms
61,000 KB
testcase_10 AC 52 ms
71,244 KB
testcase_11 AC 165 ms
105,936 KB
testcase_12 AC 52 ms
69,640 KB
testcase_13 AC 122 ms
94,068 KB
testcase_14 AC 47 ms
63,148 KB
testcase_15 AC 152 ms
99,924 KB
testcase_16 AC 531 ms
231,776 KB
testcase_17 AC 88 ms
84,184 KB
testcase_18 AC 329 ms
164,416 KB
testcase_19 AC 52 ms
70,352 KB
testcase_20 AC 47 ms
64,544 KB
testcase_21 AC 159 ms
109,464 KB
testcase_22 AC 260 ms
137,584 KB
testcase_23 AC 199 ms
128,488 KB
testcase_24 AC 195 ms
120,964 KB
testcase_25 AC 289 ms
146,460 KB
testcase_26 AC 93 ms
86,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, d, K = map(int, input().split())
dp = [[0]*(K+1) for _ in range(N+1)]
dp[0][0] = 1
MOD = 10**9+7

for i in range(N):
    acc = [0]
    
    for j in range(K+1):
        acc.append((acc[-1]+dp[i][j])%MOD)
        
    for j in range(K+1):
        dp[i+1][j] = (acc[j]-acc[max(0, j-d)])%MOD

print(dp[N][K])
0