結果

問題 No.1011 Infinite Stairs
ユーザー uni_pythonuni_python
提出日時 2020-07-12 23:03:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,219 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 1,095 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 259,540 KB
最終ジャッジ日時 2023-09-24 11:19:16
合計ジャッジ時間 7,936 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,296 KB
testcase_01 AC 70 ms
71,460 KB
testcase_02 AC 97 ms
76,432 KB
testcase_03 AC 846 ms
215,908 KB
testcase_04 AC 194 ms
77,140 KB
testcase_05 AC 1,219 ms
259,540 KB
testcase_06 AC 67 ms
71,364 KB
testcase_07 AC 83 ms
75,924 KB
testcase_08 AC 68 ms
71,308 KB
testcase_09 AC 75 ms
76,220 KB
testcase_10 AC 80 ms
75,504 KB
testcase_11 AC 216 ms
76,988 KB
testcase_12 AC 79 ms
75,684 KB
testcase_13 AC 160 ms
76,356 KB
testcase_14 AC 80 ms
75,752 KB
testcase_15 AC 195 ms
76,700 KB
testcase_16 AC 633 ms
173,692 KB
testcase_17 AC 126 ms
76,468 KB
testcase_18 AC 397 ms
131,920 KB
testcase_19 AC 87 ms
75,792 KB
testcase_20 AC 85 ms
75,780 KB
testcase_21 AC 211 ms
98,624 KB
testcase_22 AC 341 ms
122,176 KB
testcase_23 AC 236 ms
103,104 KB
testcase_24 AC 251 ms
105,412 KB
testcase_25 AC 358 ms
124,908 KB
testcase_26 AC 128 ms
75,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,d,K=MI()
    dp=[0]*(1+K)
    dp[0]=1
    
    for i in range(N):
        S=[0]*(K+1)
        for j in range(K):
            S[j+1]=(S[j]+dp[j])%mod
            
        for j in range(K,-1,-1):
            dp[j]=(S[j]-S[max(0,j-d)])%mod
            
    print(dp[-1])
        


main()
0