No.3515 Anti EIKO
タグ : / 解いたユーザー数 38
作問者 :
Germanium32
yt142857
Problem Statement
Initially, Hijiri has a string of length $4N$, $T=$ SSSSS...SSSSS, and he repeats the following operation until he faints.
- Delete $1$ character from the beginning of $T$, then choose $1$ character at random from the $5$ kinds of characters
S,E,I,K,Oand append it to the end of $T$. Here, each character is always chosen with probability $\dfrac{1}{5}$. When $T$ becomes the string formed by concatenating $N$ copies of the stringEIKO, Hijiri faints.
About probability $\bmod 998244353$
Under the constraints of this problem, the probability to be found is always a rational number $Q$, and there exists a pair of integers $(X,Y) (X \not\equiv 0 \pmod{998244353})$ satisfying $XQ=Y$. Then there is a unique integer $Z$ such that $0 \leq Z \lt 998244353$ and $XZ \equiv Y \pmod{998244353}$, so output that value.
Constraints
- All input values are integers.
- $1 \leq N \leq 25$
- $1 \leq K \leq 10^{18}$
Input
$N\ K$
Output
Output the answer on $1$ line.
Sample
Sample 1
Input
1 4
Output
771443236
The condition is satisfied only when E,I,K,O are chosen in the $1,2,3,4$-th operations, respectively. The probability is $\dfrac{1}{625}$.
Note that you must output it modulo $\bmod 998244353$.
Sample 2
Input
2 7
Output
0
The probability may be $0$. After $7$ operations, the string he remembers can never be EIKOEIKO.
Sample 3
Input
19 123456789
Output
646671269
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。