No.2883 K-powered Sum of Fibonacci
レベル :
/ AI推定難易度 : 1925
/ 実行時間制限 : 1ケース 3.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 46
作問者 :
Iroha_3856
/ テスター :
Rac
tikuwa_
hiro1729
タグ : / 解いたユーザー数 46
作問者 :
Iroha_3856
/ テスター :
問題文最終更新日: 2024-09-08 08:24:42
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Problem Statement
Define a sequence $F = (F_1, F_2, \ldots)$ as follows.
- $F_1 = 1$
- $F_2 = 1$
- $F_i = F_{i-1} + F_{i-2}\ (i \geq 3) $
You are given positive integers $N, K$.
Find $\displaystyle \left( \sum_{i=1}^N F_i^{\ K} \right) \bmod 998244353$.
Input
$N\ K$
All inputs satisfy the following constraints.
- $1 \leq N \leq 10^{18}$
- $1 \leq K \leq 100$
- $N, K$ are integers
Output
Output the answer, followed by a newline.
Sample
Sample 1
Input
4 3
Output
37
Since $F_1 = 1, F_2 = 1, F_3 = 2, F_4 = 3$, the answer is $(1^3 + 1^3 + 2^3 + 3^3) \bmod 998244353 = 37$.
Sample 2
Input
1 1
Output
1
It is possible that $N = 1$ or $K = 1$.
Sample 3
Input
1000000000000000000 100
Output
741845682
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。