結果

問題 No.1011 Infinite Stairs
ユーザー 👑 timitimi
提出日時 2020-10-13 15:04:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 1,677 ms
コンパイル使用メモリ 86,300 KB
実行使用メモリ 288,572 KB
最終ジャッジ日時 2023-09-28 00:06:13
合計ジャッジ時間 7,188 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,116 KB
testcase_01 AC 63 ms
71,132 KB
testcase_02 AC 87 ms
76,132 KB
testcase_03 AC 464 ms
215,624 KB
testcase_04 AC 154 ms
90,928 KB
testcase_05 AC 642 ms
288,572 KB
testcase_06 WA -
testcase_07 AC 79 ms
76,092 KB
testcase_08 WA -
testcase_09 AC 71 ms
75,912 KB
testcase_10 AC 75 ms
75,948 KB
testcase_11 AC 145 ms
91,104 KB
testcase_12 AC 76 ms
75,948 KB
testcase_13 AC 120 ms
90,604 KB
testcase_14 AC 71 ms
75,968 KB
testcase_15 AC 132 ms
90,832 KB
testcase_16 AC 333 ms
173,692 KB
testcase_17 AC 93 ms
76,356 KB
testcase_18 AC 227 ms
131,832 KB
testcase_19 AC 74 ms
75,988 KB
testcase_20 AC 74 ms
76,168 KB
testcase_21 AC 138 ms
98,672 KB
testcase_22 AC 196 ms
122,012 KB
testcase_23 AC 149 ms
103,372 KB
testcase_24 AC 154 ms
105,568 KB
testcase_25 AC 203 ms
124,520 KB
testcase_26 AC 100 ms
75,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,d,K=map(int, input().split())
mod=10**9+7
dp=[[0 for i in range(K+1)] for j in range(N+1)]
dp[0][0]=1
f=0
for i in range(K+1):
    if i==0:
        dp[1][i]=0
    elif i<min(d+1,K):
        f+=1
        dp[1][i]=f 
    else:
        dp[1][i]=f 

for i in range(1,N):
    for j in range(1,K+1):
        if j-d-1>0:
            dp[i+1][j]=dp[i][j-1]-dp[i][j-d-1]+dp[i+1][j-1]
            dp[i+1][j]%=mod
        else:
            dp[i+1][j]=dp[i][j-1]+dp[i+1][j-1]
            dp[i+1][j]%=mod
        if dp[i+1][j]<0:
            dp[i+1][j]=0

        
print((dp[-1][-1]-dp[-1][-2])%mod)
0