#abc381g. G - Fibonacci Product
G - Fibonacci Product
当前没有测试数据。
Score : points
问题陈述
定义一个序列 如下:
$a_n = \begin{cases} x & (n=1) \\ y & (n=2) \\ a_{n-1} + a_{n-2} & (n \geq 3) \\ \end{cases}$
找出 $\left( \displaystyle \prod_{i=1}^N a_i \right) \bmod{998244353}$。
你将解决 个测试用例。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
Define a sequence as follows:
$a_n = \begin{cases} x & (n=1) \\ y & (n=2) \\ a_{n-1} + a_{n-2} & (n \geq 3) \\ \end{cases}$
Find $\left( \displaystyle \prod_{i=1}^N a_i \right) \bmod{998244353}$.
You are given test cases to solve.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format. Here, denotes the -th test case.
Each test case is given in the following format:
Output
Print lines. The -th line should contain the answer to the -th test case.
Sample Input 1
3
5 1 1
2024 11 22
1000000000000000000 12345 6789
Sample Output 1
30
577322229
726998219
For the first test case, the elements of the sequence are . Thus, the answer is $(1 \times 1 \times 2 \times 3 \times 5) \bmod{998244353} = 30$.