結果

問題 No.1011 Infinite Stairs
ユーザー H3PO4H3PO4
提出日時 2021-08-23 09:29:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,054 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 32,136 KB
最終ジャッジ日時 2023-09-24 11:26:05
合計ジャッジ時間 8,963 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
29,552 KB
testcase_01 AC 137 ms
29,620 KB
testcase_02 AC 153 ms
29,600 KB
testcase_03 AC 733 ms
31,548 KB
testcase_04 AC 254 ms
29,944 KB
testcase_05 AC 1,054 ms
32,136 KB
testcase_06 AC 135 ms
29,600 KB
testcase_07 AC 146 ms
29,708 KB
testcase_08 AC 138 ms
29,616 KB
testcase_09 AC 137 ms
29,672 KB
testcase_10 AC 142 ms
29,596 KB
testcase_11 AC 269 ms
30,008 KB
testcase_12 AC 144 ms
29,588 KB
testcase_13 AC 219 ms
30,112 KB
testcase_14 AC 142 ms
29,676 KB
testcase_15 AC 241 ms
30,040 KB
testcase_16 AC 574 ms
30,792 KB
testcase_17 AC 179 ms
29,664 KB
testcase_18 AC 380 ms
30,684 KB
testcase_19 AC 141 ms
29,700 KB
testcase_20 AC 137 ms
29,568 KB
testcase_21 AC 238 ms
30,104 KB
testcase_22 AC 355 ms
30,204 KB
testcase_23 AC 259 ms
30,324 KB
testcase_24 AC 266 ms
30,252 KB
testcase_25 AC 350 ms
30,416 KB
testcase_26 AC 182 ms
30,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, D, K = map(int, input().split())
MOD = 10 ** 9 + 7
dp = np.zeros(K + 1, dtype=np.int64)
dp[0] = 1
for _ in range(N):
    new_dp = np.zeros(K + 1, dtype=np.int64)
    new_dp[1:] += dp[:-1]
    new_dp[D + 1:] -= dp[:-D - 1]
    new_dp %= MOD
    dp = np.cumsum(new_dp) % MOD
print(dp[K])
0