No.2752 Counting Strings mod 998244353
タグ : / 解いたユーザー数 91
作問者 : 👑
taiga0629kyopro
Problem Statement
Consider the following problem:
A positive integer $L$ is given as input.
Find the total number of strings of length at least $1$ and at most $L$ consisting only of lowercase English letters, modulo $998244353$. (Hereafter, this value is called the answer to this problem.)
A positive integer $T$ is given at the beginning of the input. Then, answer $T$ problems.
Input
The input is given from Standard Input in $1 + T$ lines in the following format:
- Line $1$ contains $T$.
- For each positive integer $t$ not exceeding $T$, line $1+t$ contains the input $L$ for the $t$-th problem.
Constraints
The input satisfies the following constraints:
- $T$ is an integer satisfying $1 \leq T \leq 10^5$
- The input $L$ for each problem is an integer satisfying $1 \leq L \leq 10^{18}$
Output
For each positive integer $t$ not exceeding $T$, output the answer to the $t$-th problem on line $t$.
Print a newline at the end.
Sample
Sample 1
Input
1 1
Output
26
There are $26$ strings of length $1$ consisting only of lowercase English letters. The remainder of $26$ divided by $998244353$ is $26$.
Sample 2
Input
3 2 1 2
As this shows, $L$ may not be monotonically increasing.
Output
702 26 702
There are $26$ strings of length $1$ and $26^2 = 676$ strings of length $2$ consisting only of lowercase English letters. The remainder of $26 + 676 = 702$ divided by $998244353$ is $702$.
Sample 3
Input
1 8
Output
561122557
There are $217180147158$ strings of length at least $1$ and at most $8$ consisting only of lowercase English letters. The remainder of $217180147158$ divided by $998244353$ is $561122557$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。