問題一覧 > 通常問題

No.1755 Almost Palindrome

レベル : / AI推定難易度 : 1550 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 51
作問者 : NyaanNyaan / テスター : tokusakurai PCTprobability
お気に入りにしたユーザー ProblemId : 7118 / 自分の提出
問題文最終更新日: 2021-11-20 20:46:55
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
yukicoder contest 324 (順位表) の他の問題:

Problem Statement

A string $S$ satisfying the following conditions is called an "almost palindrome".

  • $S$ is a string consisting of lowercase English letters from a to z.
  • $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もしくは右上の雲マークをクリックしてアカウントを作成してください。