結果

問題 No.1011 Infinite Stairs
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-16 13:40:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 516 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 259,936 KB
最終ジャッジ日時 2023-09-24 11:25:34
合計ジャッジ時間 6,592 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,164 KB
testcase_01 AC 67 ms
71,276 KB
testcase_02 AC 96 ms
76,068 KB
testcase_03 AC 367 ms
216,084 KB
testcase_04 AC 516 ms
259,936 KB
testcase_05 AC 511 ms
259,672 KB
testcase_06 AC 66 ms
71,156 KB
testcase_07 AC 129 ms
100,492 KB
testcase_08 AC 67 ms
71,220 KB
testcase_09 AC 75 ms
76,060 KB
testcase_10 AC 84 ms
76,160 KB
testcase_11 AC 259 ms
163,952 KB
testcase_12 AC 80 ms
76,044 KB
testcase_13 AC 172 ms
121,508 KB
testcase_14 AC 83 ms
76,156 KB
testcase_15 AC 143 ms
105,780 KB
testcase_16 AC 381 ms
223,408 KB
testcase_17 AC 391 ms
233,252 KB
testcase_18 AC 208 ms
138,556 KB
testcase_19 AC 77 ms
76,152 KB
testcase_20 AC 85 ms
76,160 KB
testcase_21 AC 147 ms
109,160 KB
testcase_22 AC 354 ms
208,384 KB
testcase_23 AC 145 ms
107,720 KB
testcase_24 AC 144 ms
106,276 KB
testcase_25 AC 209 ms
138,120 KB
testcase_26 AC 105 ms
91,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
1<=n,d<=300
n<=k<=n*d
貰うdp
x段目に到達できるのは前回x-d~x-1段目にいるとき
累積和で高速化
"""
n,d,k=map(int,input().split())
dp=[0]*(n*d+1)
dp[0]=1
mod=10**9+7
for _ in range(n):
  ndp=[0]*(n*d+1)
  tmp=0
  for i in range(n*d+1):
    if 0<=i-d-1:
      tmp-=dp[i-d-1]
      tmp%=mod
    ndp[i]=tmp # sum(dp[i-d:i])
    tmp+=dp[i]
    tmp%=mod
  dp=ndp
print(dp[k])
0