結果

問題 No.1011 Infinite Stairs
ユーザー hedwig100hedwig100
提出日時 2020-04-03 21:10:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 627 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 288,148 KB
最終ジャッジ日時 2023-09-24 11:11:59
合計ジャッジ時間 5,293 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,116 KB
testcase_01 AC 67 ms
71,080 KB
testcase_02 AC 80 ms
76,056 KB
testcase_03 AC 414 ms
214,688 KB
testcase_04 AC 134 ms
92,572 KB
testcase_05 AC 627 ms
288,148 KB
testcase_06 AC 65 ms
70,996 KB
testcase_07 AC 75 ms
75,608 KB
testcase_08 AC 69 ms
71,292 KB
testcase_09 AC 70 ms
75,564 KB
testcase_10 AC 74 ms
75,808 KB
testcase_11 AC 143 ms
92,876 KB
testcase_12 AC 76 ms
75,524 KB
testcase_13 AC 121 ms
92,040 KB
testcase_14 AC 77 ms
75,512 KB
testcase_15 AC 128 ms
92,680 KB
testcase_16 AC 316 ms
173,376 KB
testcase_17 AC 90 ms
76,192 KB
testcase_18 AC 218 ms
131,940 KB
testcase_19 AC 73 ms
75,744 KB
testcase_20 AC 71 ms
75,632 KB
testcase_21 AC 131 ms
98,480 KB
testcase_22 AC 184 ms
122,012 KB
testcase_23 AC 139 ms
103,064 KB
testcase_24 AC 144 ms
105,640 KB
testcase_25 AC 198 ms
124,536 KB
testcase_26 AC 90 ms
75,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n,d,k = map(int,input().split())
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        for j in range(1,k + 1):
            dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j - 1])%MOD
            if j - d  - 1>= 0:
                dp[i + 1][j] += MOD - dp[i][j - d - 1]
                dp[i + 1][j] %= MOD
    print(dp[-1][-1])

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