結果

問題 No.1011 Infinite Stairs
ユーザー TsuboTsubo
提出日時 2020-03-21 09:37:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 677 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 918 ms
コンパイル使用メモリ 86,600 KB
実行使用メモリ 288,372 KB
最終ジャッジ日時 2023-09-24 11:05:32
合計ジャッジ時間 6,845 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,300 KB
testcase_01 AC 67 ms
71,340 KB
testcase_02 AC 89 ms
76,036 KB
testcase_03 AC 481 ms
215,628 KB
testcase_04 AC 144 ms
92,576 KB
testcase_05 AC 677 ms
288,372 KB
testcase_06 AC 66 ms
71,136 KB
testcase_07 AC 80 ms
75,480 KB
testcase_08 AC 64 ms
71,072 KB
testcase_09 AC 74 ms
75,812 KB
testcase_10 AC 77 ms
75,484 KB
testcase_11 AC 157 ms
92,552 KB
testcase_12 AC 78 ms
75,644 KB
testcase_13 AC 127 ms
92,068 KB
testcase_14 AC 72 ms
75,644 KB
testcase_15 AC 141 ms
92,748 KB
testcase_16 AC 359 ms
173,520 KB
testcase_17 AC 97 ms
75,932 KB
testcase_18 AC 237 ms
131,848 KB
testcase_19 AC 76 ms
75,688 KB
testcase_20 AC 76 ms
75,556 KB
testcase_21 AC 141 ms
98,348 KB
testcase_22 AC 214 ms
122,060 KB
testcase_23 AC 160 ms
102,900 KB
testcase_24 AC 164 ms
105,276 KB
testcase_25 AC 220 ms
124,812 KB
testcase_26 AC 96 ms
75,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N,d,K=map(int,readline().split())
    dp=[[0]*(K+1) for _ in range(N+1)]
    dp[0][0]=1

    for i in range(1,N+1):
        for j in range(i,K+1):
            dp[i][j]+=dp[i-1][j-1]
            if 0<=j-d-1<=K:
                dp[i][j]-=dp[i-1][j-d-1]
        for j in range(i,K+1):
            dp[i][j]+=dp[i][j-1]
            dp[i][j]%=10**9+7

    print(dp[N][K])

if __name__=="__main__":
    main()
0