No.1755 Almost Palindrome
タグ : / 解いたユーザー数 51
作問者 :
PCTprobability
Problem Statement
A string $S$ satisfying the following conditions is called an "almost palindrome".
- $S$ is a string consisting of lowercase English letters from
atoz. - $S$ is not a palindrome.
- There exists an $i\ (1 \leq i \leq |S|)$ such that removing the $i$-th character from $S$ results in a palindrome.
For example, let $S = $ nyaan. $S$ is not a palindrome, but removing the 2nd character y gives naan, which is a palindrome, so $S$ is an "almost palindrome".
Given $N$, find the number of "almost palindromes" of length $N$, modulo $998244353$.
You are given $T$ test cases; find the answer for each of them.
Constraints
- All inputs are integers.
- $1 \leq T \leq 10^5$
- $1 \leq N \leq 10^6$
Input
The input is given in the following format.$T$
$\mathrm{case}1$
$\vdots$
$\mathrm{case}T$
Each case is given in the following format.
$N$
Output
Print $T$ lines, followed by a newline at the end.
On the $i$-th line, print the answer to the $i$-th test case.
Sample
Sample 1
Input
5 1 2 3 100 133333
Output
0 650 1300 81960607 708231776
There are clearly $0$ "almost palindromes" of length $1$.
The number of "almost palindromes" of length $2$ equals the number of strings of length $2$ whose $1$st and $2$nd characters differ, which is $26 \times 25 = 650$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。