| Algo Cup 2025 by csspace.io (Finals) |
|---|
| Finished |
Recall that a binary string is a string consisting of the characters 0 and/or 1. A substring of a binary string is defined as its continuous subsequence.
Suppose you have a binary string $$$s$$$. You can perform the following sequence of operations on it:
After each removal, the resulting parts of the string are glued together in the same order. The operations can be terminated at any moment (including leaving the string unchanged).
We call a binary string beautiful if it is possible to remove all zeros from it using such a sequence of operations. For example:
Your task is to count the number of beautiful binary strings of length $$$n$$$.
The input consists of a single line containing one integer $$$n$$$ ($$$2 \le n \le 2\,000\,000$$$).
Output a single integer — the number of beautiful binary strings of length $$$n$$$, taken modulo $$$998244353$$$.
2
4
3
7
4
13
13
724
42
1346030
1234567
163685965
For $$$n=2$$$, all binary strings are beautiful.
For $$$n=3$$$, all binary strings except 010 are beautiful.
| Name |
|---|


