#Q241. 「一本通 6.6 练习 10」有趣的数列
「一本通 6.6 练习 10」有趣的数列
Description
We call a sequence of length interesting if and only if it satisfies the following three conditions:
- It is a permutation of the integers from to ;
- All odd-indexed terms satisfy , and all even-indexed terms satisfy ;
- Any two adjacent terms and satisfy that the odd-indexed term is less than the even-indexed term, i.e., .
The task is: For a given , determine how many different interesting sequences of length exist. Since the final answer may be very large, only output the answer modulo .
Input Format
The input contains only two integers and separated by a space.
Output Format
Output a single integer, representing the number of different interesting sequences of length modulo .
Sample 1
The corresponding interesting sequences are $\{1,2,3,4,5,6\},\{1,2,3,5,4,6\},\{1,3,2,4,5,6\},\{1,3,2,5,4,6\},\{1,4,2,5,3,6\}$.
3 10
5
Data Range and Hints
For of the data, ;
For all data, .