結果

問題 No.1011 Infinite Stairs
ユーザー takakintakakin
提出日時 2020-03-22 18:45:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 556 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 260,144 KB
最終ジャッジ日時 2023-09-24 11:08:13
合計ジャッジ時間 6,916 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,520 KB
testcase_01 AC 79 ms
71,332 KB
testcase_02 AC 103 ms
76,660 KB
testcase_03 AC 402 ms
216,440 KB
testcase_04 AC 552 ms
260,144 KB
testcase_05 AC 556 ms
259,960 KB
testcase_06 AC 77 ms
71,376 KB
testcase_07 AC 146 ms
100,740 KB
testcase_08 AC 75 ms
71,304 KB
testcase_09 AC 85 ms
75,956 KB
testcase_10 AC 98 ms
76,248 KB
testcase_11 AC 283 ms
164,168 KB
testcase_12 AC 86 ms
76,176 KB
testcase_13 AC 182 ms
121,548 KB
testcase_14 AC 86 ms
76,300 KB
testcase_15 AC 151 ms
105,868 KB
testcase_16 AC 410 ms
223,524 KB
testcase_17 AC 427 ms
233,372 KB
testcase_18 AC 225 ms
138,316 KB
testcase_19 AC 83 ms
76,224 KB
testcase_20 AC 92 ms
76,176 KB
testcase_21 AC 164 ms
109,220 KB
testcase_22 AC 384 ms
208,544 KB
testcase_23 AC 157 ms
107,556 KB
testcase_24 AC 155 ms
106,528 KB
testcase_25 AC 227 ms
138,064 KB
testcase_26 AC 119 ms
90,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,d,k=map(int,input().split())
mod=10**9+7
A=[0]*(n*d+1)
A[0]=1
for _ in range(n):
  B=[0]*(n*d+1)
  for i in range(n*d+1):
    if not A[i]:
      continue
    else:
      B[i+1]+=A[i]
      if i+d+1<=n*d:
        B[i+d+1]-=A[i]
  A[0]=0
  for i in range(1,n*d+1):
    A[i]=(A[i-1]+B[i])%mod
print(A[k])
0