結果

問題 No.1011 Infinite Stairs
ユーザー DrDrpilotDrDrpilot
提出日時 2022-06-24 13:15:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 565 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 271,944 KB
最終ジャッジ日時 2024-04-25 18:14:04
合計ジャッジ時間 6,067 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,212 KB
testcase_01 AC 37 ms
52,832 KB
testcase_02 AC 61 ms
68,388 KB
testcase_03 AC 385 ms
201,896 KB
testcase_04 AC 558 ms
271,944 KB
testcase_05 AC 565 ms
270,580 KB
testcase_06 AC 37 ms
52,824 KB
testcase_07 AC 106 ms
86,344 KB
testcase_08 AC 37 ms
52,532 KB
testcase_09 AC 42 ms
60,648 KB
testcase_10 AC 60 ms
68,468 KB
testcase_11 AC 260 ms
149,552 KB
testcase_12 AC 53 ms
64,640 KB
testcase_13 AC 158 ms
107,084 KB
testcase_14 AC 53 ms
64,940 KB
testcase_15 AC 119 ms
92,068 KB
testcase_16 AC 397 ms
209,972 KB
testcase_17 AC 426 ms
220,084 KB
testcase_18 AC 196 ms
124,184 KB
testcase_19 AC 47 ms
62,208 KB
testcase_20 AC 56 ms
66,816 KB
testcase_21 AC 125 ms
94,800 KB
testcase_22 AC 367 ms
194,192 KB
testcase_23 AC 124 ms
93,784 KB
testcase_24 AC 121 ms
92,656 KB
testcase_25 AC 197 ms
124,660 KB
testcase_26 AC 83 ms
77,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,k=map(int,input().split())
mod=10**9+7
dp=[[0]*(n*d+1) for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
    tmp=0
    for j in range(n*d+1):
        if j==0:
            continue
        tmp+=dp[i-1][j-1]
        if j-d-1>=0:
            tmp-=dp[i-1][j-d-1]
        tmp%=mod
        dp[i][j]=tmp
print(dp[-1][k])
0