No.2156 Zoi Strings
タグ : / 解いたユーザー数 148
作問者 :
hibit_at
/ テスター :
kotamanegi
KowerKoint2010
keisuke6
Michirakara
Problem Statement
On the Discord server "Asakatsu", it has become a habit to post messages such as "ぞい", "ぞいぞい", and "ぞぞい" before contests.
Such strings are called "zoi strings".
A zoi string is defined as a string satisfying the following properties.
- The string consists only of "ぞ" and "い".
- The string starts with "ぞ".
- The string contains at least one "い".
- The string must not contain 2 consecutive "い".
Given a positive integer $N$, find the number of zoi strings of length $N$, modulo 998244353.
Input
$N$
- $N$ is an integer.
- $2 \leq N \leq 10^{18}$
Output
Output an integer on $1$ line. Print a newline at the end.
Sample
Sample 1
Input
2
Output
1
The only possible zoi string is "ぞい".
Sample 2
Input
4
Output
4
There are $4$ possibilities: "ぞぞぞい", "ぞいぞい", "ぞぞいぞ", and "ぞいぞぞ".
Sample 3
Input
100000
Output
56136313
A zoi string can be fairly long.
Output the remainder when divided by
998244353.
Sample 4
Input
1000000000000000000
Output
332172356
A zoi string can be very long.
Output the remainder when divided by
998244353.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。