結果

問題 No.1011 Infinite Stairs
ユーザー 👑 H20H20
提出日時 2021-06-25 16:25:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 869 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 209,696 KB
最終ジャッジ日時 2023-09-24 11:25:27
合計ジャッジ時間 9,284 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,552 KB
testcase_01 AC 75 ms
71,228 KB
testcase_02 AC 108 ms
77,580 KB
testcase_03 AC 609 ms
162,996 KB
testcase_04 AC 869 ms
209,696 KB
testcase_05 AC 863 ms
209,568 KB
testcase_06 AC 75 ms
71,444 KB
testcase_07 AC 177 ms
92,980 KB
testcase_08 AC 74 ms
71,448 KB
testcase_09 AC 83 ms
76,408 KB
testcase_10 AC 110 ms
78,140 KB
testcase_11 AC 421 ms
131,812 KB
testcase_12 AC 96 ms
77,160 KB
testcase_13 AC 277 ms
120,292 KB
testcase_14 AC 99 ms
77,088 KB
testcase_15 AC 192 ms
87,552 KB
testcase_16 AC 638 ms
171,016 KB
testcase_17 AC 670 ms
178,192 KB
testcase_18 AC 327 ms
119,556 KB
testcase_19 AC 89 ms
76,476 KB
testcase_20 AC 107 ms
77,960 KB
testcase_21 AC 227 ms
108,928 KB
testcase_22 AC 584 ms
167,000 KB
testcase_23 AC 209 ms
107,100 KB
testcase_24 AC 197 ms
97,104 KB
testcase_25 AC 323 ms
116,736 KB
testcase_26 AC 144 ms
89,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N,d,K = map(int,input().split())
mod = 10**9+7
DP = [0]*((N+2)*d)
DP[0] = 1
lenDP = len(DP)
for _ in range(N):
    TEMP = [0]*(lenDP)
    for i in range(lenDP):
        if DP[i]>=1:
            TEMP[i+1]+=DP[i]
            TEMP[i+d+1]-=DP[i]
    DP = list(itertools.accumulate(TEMP))
    for i in range(lenDP):
        DP[i]=DP[i]%mod
print(DP[K])
0