結果

問題 No.1011 Infinite Stairs
ユーザー stngstng
提出日時 2022-08-17 21:49:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 748 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 260,036 KB
最終ジャッジ日時 2024-04-15 09:45:39
合計ジャッジ時間 5,428 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
51,996 KB
testcase_01 AC 43 ms
53,412 KB
testcase_02 AC 67 ms
72,792 KB
testcase_03 AC 594 ms
258,368 KB
testcase_04 AC 111 ms
77,120 KB
testcase_05 AC 748 ms
258,564 KB
testcase_06 AC 39 ms
52,932 KB
testcase_07 AC 58 ms
67,040 KB
testcase_08 AC 39 ms
52,552 KB
testcase_09 AC 46 ms
61,852 KB
testcase_10 AC 55 ms
65,972 KB
testcase_11 AC 124 ms
77,836 KB
testcase_12 AC 56 ms
64,552 KB
testcase_13 AC 97 ms
76,420 KB
testcase_14 AC 49 ms
61,444 KB
testcase_15 AC 113 ms
77,040 KB
testcase_16 AC 383 ms
260,036 KB
testcase_17 AC 79 ms
75,872 KB
testcase_18 AC 279 ms
231,388 KB
testcase_19 AC 55 ms
65,680 KB
testcase_20 AC 50 ms
61,524 KB
testcase_21 AC 148 ms
131,740 KB
testcase_22 AC 240 ms
201,012 KB
testcase_23 AC 166 ms
144,668 KB
testcase_24 AC 174 ms
150,816 KB
testcase_25 AC 249 ms
209,636 KB
testcase_26 AC 79 ms
76,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,K = map(int,input().split())
dp = [0]*(K+1)
dp[0] = 1
mod = 10**9+7

for i in range(n):
    ndp = [0]*(K+1)
    dr = [0]*(K+2)
    for j in range(K+1):
        dr[j+1] = dr[j]+dp[j]
        dr[j+1] %= mod
    
    for j in range(K+1):
        ndp[j] = dr[j]-dr[max(0,j-d)]+mod
        ndp[j] %= mod
    #print(dr,dp,ndp,"d")
    dp = ndp[:]

print(dp[K])
0