#AT2540. Ex - Diff Adjacent
Ex - Diff Adjacent
当前没有测试数据。
Ex - Diff Adjacent
Score : $600$ points
Problem Statement
A positive-integer sequence is said to be splendid if no two adjacent elements are equal.
Find the sum, modulo $998244353$, of the lengths of all splendid sequences whose elements have a sum of $N$.
Constraints
- $1 \le N \le 2 \times 10^5$
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
4
8
There are four splendid sequences whose sum is $4$: $(4),(1,3),(3,1),(1,2,1)$. Thus, the answer is the sum of their lengths: $1+2+2+3=8$.
$(2,2)$ and $(1,1,2)$ also have a sum of $4$ but ineligible because their $1$-st and $2$-nd elements are the same.
297
475867236
123456
771773807