結果

問題 No.1011 Infinite Stairs
ユーザー 👑 KazunKazun
提出日時 2021-02-19 05:31:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 77,936 KB
最終ジャッジ日時 2023-09-24 11:23:37
合計ジャッジ時間 4,941 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,240 KB
testcase_01 AC 72 ms
70,928 KB
testcase_02 AC 93 ms
76,144 KB
testcase_03 AC 294 ms
77,424 KB
testcase_04 AC 118 ms
76,212 KB
testcase_05 AC 405 ms
77,936 KB
testcase_06 AC 72 ms
71,444 KB
testcase_07 AC 83 ms
76,024 KB
testcase_08 AC 72 ms
71,436 KB
testcase_09 AC 78 ms
76,324 KB
testcase_10 AC 87 ms
76,036 KB
testcase_11 AC 127 ms
76,472 KB
testcase_12 AC 83 ms
76,136 KB
testcase_13 AC 109 ms
76,240 KB
testcase_14 AC 79 ms
76,040 KB
testcase_15 AC 118 ms
76,468 KB
testcase_16 AC 232 ms
77,188 KB
testcase_17 AC 96 ms
76,548 KB
testcase_18 AC 167 ms
76,940 KB
testcase_19 AC 83 ms
76,120 KB
testcase_20 AC 79 ms
75,976 KB
testcase_21 AC 118 ms
76,452 KB
testcase_22 AC 152 ms
76,708 KB
testcase_23 AC 122 ms
76,496 KB
testcase_24 AC 127 ms
76,600 KB
testcase_25 AC 157 ms
76,836 KB
testcase_26 AC 97 ms
76,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,d,K=map(int,input().split())
Mod=10**9+7

X=[0]*(K+1)
Y=[0]*(K+1)
Y[0]=1

for _ in range(N):
    x=0
    for i in range(K+1):
        X[i]=x=(x+Y[i])%Mod

    for i in range(K+1):
        if i==0:
            Y[i]=0
        elif 1<=i<=d:
            Y[i]=X[i-1]
        else:
            Y[i]=(X[i-1]-X[i-d-1])%Mod
print(Y[K])
0