結果

問題 No.1011 Infinite Stairs
ユーザー tcltktcltk
提出日時 2021-01-18 02:09:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 690 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 262,140 KB
最終ジャッジ日時 2023-09-24 11:23:23
合計ジャッジ時間 9,683 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
83,368 KB
testcase_01 AC 215 ms
83,072 KB
testcase_02 AC 233 ms
86,032 KB
testcase_03 AC 574 ms
262,092 KB
testcase_04 AC 262 ms
86,840 KB
testcase_05 AC 690 ms
262,140 KB
testcase_06 AC 206 ms
82,964 KB
testcase_07 AC 226 ms
85,808 KB
testcase_08 AC 205 ms
83,416 KB
testcase_09 AC 218 ms
83,852 KB
testcase_10 AC 217 ms
83,936 KB
testcase_11 AC 270 ms
87,608 KB
testcase_12 AC 217 ms
83,736 KB
testcase_13 AC 254 ms
86,160 KB
testcase_14 AC 221 ms
83,840 KB
testcase_15 AC 277 ms
86,776 KB
testcase_16 AC 521 ms
262,132 KB
testcase_17 AC 249 ms
86,044 KB
testcase_18 AC 395 ms
194,812 KB
testcase_19 AC 216 ms
83,948 KB
testcase_20 AC 224 ms
83,864 KB
testcase_21 AC 291 ms
129,276 KB
testcase_22 AC 356 ms
174,688 KB
testcase_23 AC 302 ms
138,256 KB
testcase_24 AC 304 ms
142,648 KB
testcase_25 AC 355 ms
180,304 KB
testcase_26 AC 226 ms
86,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """6 3 10
# """
# sys.stdin = io.StringIO(_INPUT)

MOD = 1000000007

def main():
    N, d, K = map(int, input().split())

    dp = [0 for _ in range(K+1)]
    dp[0] = 1
    for _ in range(N):
        dp1 = [0 for _ in range(K+1)]
        S = [0 for _ in range(K+1)]
        S[0] = dp[0]
        for k in range(1, K+1):
            S[k] = S[k-1] + dp[k]
        for i in range(1, K+1):
            if i-d <= 0:
                dp1[i] = S[i-1] % MOD
            else:
                dp1[i] = (S[i-1] - S[i-d-1]) % MOD
        dp = dp1
    print(dp[K])

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