結果

問題 No.1892 Extended Fib Series
ユーザー KDKJKDKJ
提出日時 2023-12-22 17:12:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 732 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 120,888 KB
最終ジャッジ日時 2023-12-22 17:12:33
合計ジャッジ時間 5,070 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 438 ms
76,096 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop, heapify
import sys
from collections import defaultdict, deque
from math import ceil, floor, sqrt, factorial, gcd
from itertools import permutations, combinations, chain
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10**7)
# input = sys.stdin.readline
vector1 = [[-1, 0], [1, 0], [0, 1], [0, -1]]
vector2 = [[0, 1], [1, 0], [-1, 0], [0, -1],
           [1.-1], [-1, 1], [1, 1], [-1, 1]]


def main():
    N, L = map(int, input().split())
    mod = 10**9 + 7
    d = defaultdict(int)
    d[0] = 1
    i = 0
    while i < N:
        for j in range(i+1, min(N, i+L)+1):
            d[j] = (d[j]+d[i]) % mod
        i += 1
    print(d[N])


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