#P5999. [CEOI 2016] kangaroo
[CEOI 2016] kangaroo
Description
There is a garden with bushes in a line, numbered . A kangaroo starts from , and each time it jumps one step to a different bush, visiting every bush exactly once, and finally arrives at . Obviously, it will jump times. In order not to be discovered by humans, the direction of each jump must be different from the previous one.
More specifically, if it is currently at , it jumped from to reach , and then it jumps to :
- If , then it must hold that .
- If , then it must hold that .
Ask for the number of valid routes from to modulo .
Two routes are different if and only if the visiting order of the bushes is different.
It is guaranteed that there is at least one valid route.
At the beginning, it may jump in any direction.
Input Format
One line with three integers .
Output Format
One line with one integer, representing the answer.
4 2 3
2
Hint
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号