結果

問題 No.1011 Infinite Stairs
ユーザー NoneNone
提出日時 2021-02-26 17:32:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 747 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 218,564 KB
最終ジャッジ日時 2023-09-24 11:23:51
合計ジャッジ時間 6,198 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,192 KB
testcase_01 AC 72 ms
71,200 KB
testcase_02 AC 91 ms
77,208 KB
testcase_03 AC 523 ms
169,740 KB
testcase_04 AC 149 ms
79,252 KB
testcase_05 AC 747 ms
218,564 KB
testcase_06 AC 71 ms
71,388 KB
testcase_07 AC 87 ms
76,780 KB
testcase_08 AC 71 ms
71,248 KB
testcase_09 AC 75 ms
75,872 KB
testcase_10 AC 82 ms
76,308 KB
testcase_11 AC 158 ms
80,812 KB
testcase_12 AC 83 ms
76,184 KB
testcase_13 AC 129 ms
78,888 KB
testcase_14 AC 81 ms
76,108 KB
testcase_15 AC 142 ms
79,956 KB
testcase_16 AC 406 ms
145,060 KB
testcase_17 AC 109 ms
77,032 KB
testcase_18 AC 266 ms
118,216 KB
testcase_19 AC 82 ms
76,240 KB
testcase_20 AC 81 ms
76,140 KB
testcase_21 AC 156 ms
92,548 KB
testcase_22 AC 231 ms
99,244 KB
testcase_23 AC 180 ms
107,956 KB
testcase_24 AC 177 ms
97,816 KB
testcase_25 AC 242 ms
104,172 KB
testcase_26 AC 114 ms
77,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #



###################################################
def example():
    global input
    example = iter(
        """
300 300 90000


        """
            .strip().split("\n"))
    input = lambda: next(example)
###################################################

import sys
input = sys.stdin.readline
from bisect import bisect_left, bisect_right

# example()

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

dp=[0]*(K+2)
dp[0]=1
for n in range(1,N+1):
    for k in range(min((n-1)*d,K)+1)[::-1]:
        dp[k+1]+=dp[k]
        dp[min(k+d,K)+1]-=dp[k]
        dp[k]=0
    acc=[0]
    for a in dp:
        acc.append((acc[-1]+a)%MOD)
    dp=acc[1:]

print(dp[K]%MOD)
0