#P2490. [SDOI2011] 黑白棋
[SDOI2011] 黑白棋
Description
A and B came up with a new game.
The game is played on a board. There are pieces on the board, half black and half white.
The leftmost piece is white, the rightmost piece is black, and adjacent pieces have alternating colors.

A may move white pieces, and B may move black pieces. White pieces cannot move left, and black pieces cannot move right. On each turn, they may move to pieces.
When moving a piece, it cannot cross over neighboring pieces on either side, and it cannot move off the board. Whoever has no legal move loses.
A and B take turns, with A moving first. How many initial arrangements of the pieces will make A win?
Input Format
Input three numbers .
Output Format
Output the total number of initial configurations in which A wins. Print the answer modulo .
10 4 2
182
Hint
- For of the testdata, .
- For of the testdata, , is even, and .
Translated by ChatGPT 5
京公网安备 11011102002149号