結果

問題 No.3457 Fibo-shrink
コンテスト
ユーザー koheijkt
提出日時 2026-02-28 13:54:41
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 1,190 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 476 ms
コンパイル使用メモリ 77,908 KB
実行使用メモリ 71,440 KB
最終ジャッジ日時 2026-02-28 13:54:44
合計ジャッジ時間 2,345 ms
ジャッジサーバーID
(参考情報)
judge7 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys, math
sys.setrecursionlimit(10**8)
sys.set_int_max_str_digits(0)
INF = 1e18
MOD = 10007
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import product, combinations, permutations, groupby, accumulate
from heapq import heapify, heappop, heappush
input = sys.stdin.readline
def I():   return input().rstrip()
def II():  return int(input().rstrip())
def IS():  return input().rstrip().split()
def MII(): return map(int, input().rstrip().split())
def LI():  return list(input().rstrip())
def TII(): return tuple(map(int, input().rstrip().split()))
def LII(): return list(map(int, input().rstrip().split()))
def LSI(): return list(map(str, input().rstrip().split()))
def GMI(): return list(map(lambda x: int(x) - 1, input().rstrip().split()))
def kiriage(a, b): return (a+b-1)//b

K, S, N = MII()

fib = [1, 1]
for i in range(K):
    fib.append(fib[-2] + fib[-1])

invfib = []
for i in range(K + 2):
    invfib.append(pow(fib[i], -1, MOD))

A = [0]*K
A.append(S)

for i in range(2, N + 1):
    memo = 0
    for j in range(K + 1):
        memo += A[-1 -j] * invfib[j]
        memo %= MOD
    A.append(memo)

print(A[-1])
0