結果

問題 No.1892 Extended Fib Series
ユーザー KDKJKDKJ
提出日時 2023-12-22 17:25:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 95,540 KB
最終ジャッジ日時 2023-12-22 17:25:41
合計ジャッジ時間 3,434 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
62,184 KB
testcase_01 AC 78 ms
87,420 KB
testcase_02 AC 68 ms
80,492 KB
testcase_03 AC 53 ms
65,512 KB
testcase_04 AC 63 ms
74,364 KB
testcase_05 AC 49 ms
62,184 KB
testcase_06 AC 84 ms
94,432 KB
testcase_07 AC 61 ms
73,952 KB
testcase_08 AC 68 ms
78,672 KB
testcase_09 AC 69 ms
78,672 KB
testcase_10 AC 67 ms
74,348 KB
testcase_11 AC 48 ms
62,184 KB
testcase_12 AC 66 ms
72,172 KB
testcase_13 AC 69 ms
80,492 KB
testcase_14 AC 43 ms
55,600 KB
testcase_15 AC 44 ms
55,600 KB
testcase_16 AC 44 ms
55,600 KB
testcase_17 AC 43 ms
55,600 KB
testcase_18 AC 44 ms
55,600 KB
testcase_19 AC 44 ms
55,600 KB
testcase_20 AC 43 ms
55,600 KB
testcase_21 AC 43 ms
55,600 KB
testcase_22 AC 43 ms
55,600 KB
testcase_23 AC 54 ms
55,600 KB
testcase_24 AC 44 ms
55,600 KB
testcase_25 AC 44 ms
55,600 KB
testcase_26 AC 43 ms
55,600 KB
testcase_27 AC 71 ms
55,600 KB
testcase_28 AC 44 ms
55,600 KB
testcase_29 AC 67 ms
78,204 KB
testcase_30 AC 65 ms
78,288 KB
testcase_31 AC 65 ms
78,288 KB
testcase_32 AC 82 ms
95,540 KB
権限があれば一括ダウンロードができます

ソースコード

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[1] = 1
    d[0] = 1
    for i in range(2, N+1):
        d[i] = (2*d[i-1]-d[i-L-1]) % mod
    print(d[N] % mod)


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