結果

問題 No.1011 Infinite Stairs
ユーザー Ldio03Ldio03
提出日時 2020-03-20 22:13:04
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,001 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 501,288 KB
最終ジャッジ日時 2023-09-24 10:58:53
合計ジャッジ時間 9,140 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,344 KB
testcase_01 AC 72 ms
71,292 KB
testcase_02 AC 112 ms
89,856 KB
testcase_03 AC 632 ms
356,404 KB
testcase_04 AC 879 ms
500,604 KB
testcase_05 AC 1,001 ms
501,288 KB
testcase_06 AC 68 ms
71,648 KB
testcase_07 AC 177 ms
125,348 KB
testcase_08 AC 69 ms
71,292 KB
testcase_09 AC 74 ms
76,488 KB
testcase_10 AC 109 ms
91,008 KB
testcase_11 AC 415 ms
251,596 KB
testcase_12 AC 90 ms
76,612 KB
testcase_13 AC 255 ms
167,084 KB
testcase_14 AC 88 ms
76,368 KB
testcase_15 AC 189 ms
135,208 KB
testcase_16 AC 631 ms
370,920 KB
testcase_17 AC 666 ms
390,868 KB
testcase_18 AC 310 ms
200,852 KB
testcase_19 AC 84 ms
76,212 KB
testcase_20 AC 108 ms
88,012 KB
testcase_21 AC 219 ms
142,568 KB
testcase_22 AC 586 ms
341,096 KB
testcase_23 AC 203 ms
139,536 KB
testcase_24 AC 201 ms
136,964 KB
testcase_25 AC 318 ms
199,612 KB
testcase_26 AC 141 ms
106,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,k=map(int,input().split())
dp=[[0 for j in range(n*d+1)] for i in range(n+1)]
dp[0][0]=1
dsum=[[0 for i in range(n*d+1)] for j in range(n+1)]
dsum[0][0]=1
MOD=10**9+7
for i in range(1,n+1):
    for j in range(1,n*d+1):
        if j<=d:
            dp[i][j]=dsum[i-1][j-1]
            dsum[i][j]=dp[i][j]+dsum[i][j-1]
            dsum[i][j]%=MOD
        else:
            dp[i][j]=dsum[i-1][j-1]-dsum[i-1][j-d-1]
            dsum[i][j]=dp[i][j]+dsum[i][j-1]
            dsum[i][j]%=MOD
print(dsum[n][k])
0