No.2600 Avator Height
タグ : / 解いたユーザー数 162
作問者 : 👑
amentorimaru
/ テスター :
cleantted
👑 Problem Statement
In a certain virtual space, you can freely change the size of your own avatar.
Two creatures, Rataryuru and Etowanyu, have decided to run a three-legged race.
The stride lengths of Rataryuru and Etowanyu at their $i$-th step are given by the squares of $R_i,E_i$ below, respectively.
$ R_i = \left\{ \begin{array}{ll} 1 & (i = 1)\\ 1 & (i = 2)\\ R_{i-1}+R_{i-2} & (i \geq 3) \end{array} \right. $
$ E_i = \left\{ \begin{array}{ll} 1 & (i = 1)\\ 3 & (i = 2)\\ E_{i-1}+E_{i-2} & (i \geq 3) \end{array} \right. $
After practicing, Rataryuru's stride turned out to be clearly smaller, so Rataryuru set his avatar size to $5$ times the original.
Given $Q$ positive integers $N_1,N_2,\dots ,N_Q$, find, for each of them, the difference in stride $5\times R_{N_i}^2 - E_{N_i}^2$ modulo $998244353$.
Input
$Q$ $N_1$ $N_2$ $\vdots$ $N_Q$
- All inputs are integers.
- $1\le Q \le 2 \times 10^{5}$
- $1\le N_i \le 2 \times 10^{5}$
Output
Output the $Q$ answers, separated by newlines.
Sample
Sample 1
Input
2 3 200000
Output
4 998244349
For example, in the first case,
$R_3=R_1+R_2=2$
$E_3=E_1+E_2=4$
and so $5\times R_3^2 - E_3^2 = 5 \times 4 - 16 = 4$.
Even when $R_i,E_i$ become huge or the answer is negative, find the remainder modulo $998244353$ so that it is a positive value.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。