atcoder#ABC297H. [ABC297Ex] Diff Adjacent
[ABC297Ex] Diff Adjacent
Score : points
Problem Statement
A positive-integer sequence is said to be splendid if no two adjacent elements are equal.
Find the sum, modulo , of the lengths of all splendid sequences whose elements have a sum of .
Constraints
- 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 : . Thus, the answer is the sum of their lengths: .
and also have a sum of but ineligible because their -st and -nd elements are the same.
297
475867236
123456
771773807