結果

問題 No.1011 Infinite Stairs
ユーザー roarisroaris
提出日時 2020-06-27 20:46:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 974 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 403,888 KB
最終ジャッジ日時 2023-09-24 11:18:44
合計ジャッジ時間 7,248 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,424 KB
testcase_01 AC 71 ms
71,256 KB
testcase_02 AC 98 ms
79,912 KB
testcase_03 AC 653 ms
261,968 KB
testcase_04 AC 184 ms
101,836 KB
testcase_05 AC 974 ms
403,888 KB
testcase_06 AC 70 ms
71,348 KB
testcase_07 AC 91 ms
78,536 KB
testcase_08 AC 70 ms
71,572 KB
testcase_09 AC 77 ms
76,560 KB
testcase_10 AC 86 ms
76,556 KB
testcase_11 AC 200 ms
107,416 KB
testcase_12 AC 86 ms
76,368 KB
testcase_13 AC 155 ms
95,308 KB
testcase_14 AC 80 ms
76,308 KB
testcase_15 AC 183 ms
101,036 KB
testcase_16 AC 559 ms
232,332 KB
testcase_17 AC 117 ms
85,424 KB
testcase_18 AC 355 ms
165,696 KB
testcase_19 AC 85 ms
76,404 KB
testcase_20 AC 80 ms
76,316 KB
testcase_21 AC 192 ms
110,624 KB
testcase_22 AC 294 ms
139,748 KB
testcase_23 AC 233 ms
129,912 KB
testcase_24 AC 225 ms
122,368 KB
testcase_25 AC 310 ms
147,564 KB
testcase_26 AC 123 ms
87,436 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