#Q237. 「一本通 6.6 练习 6」序列统计
「一本通 6.6 练习 6」序列统计
Description
Original source: BZOJ 4403
Given three positive integers , , and , count the number of non-decreasing sequences with lengths between and , where each element is between and . Output the result modulo .
Input Format
The first line of input contains an integer , representing the number of test cases.
Lines to each contain three integers , , and , with meanings as described in the problem.
Output Format
Output lines, each containing a single number representing the answer modulo .
Sample 1
For the first test case, the two valid sequences are and .
2
1 4 5
2 4 5
2
5
Constraints & Hints
For all input, , , and it is guaranteed that .