#P3204. [HNOI2010] 公交线路
[HNOI2010] 公交线路
Description
There are bus stops in Xiao Z’s city, arranged on a straight line of length , numbered from left to right as to . The distance between any two adjacent bus stops is . As the planner of bus routes, Xiao Z decides to design the routes according to the following rules:
- Suppose there are buses. Then stops to serve as the starting stops, and stops to serve as the terminal stops.
- Each stop must be visited by exactly one bus (starting and terminal stops are also considered visited).
- A bus may only travel from a lower-numbered stop to a higher-numbered stop.
- For any single bus, the distance between two consecutive stops it visits must not exceed .
Before finalizing the design, Xiao Z wants to know how many valid plans satisfy the rules. Since the answer can be large, output the result modulo .
Input Format
A single line contains three positive integers , , and , representing the number of bus stops, the number of buses, and the distance limit between consecutive stops, respectively.
Output Format
Output a single integer: the number of valid plans modulo .
10 3 3
1
5 2 3
3
10 2 4
81
Hint
Sample explanation:
- Sample 1 has the following valid plan: , , .
- Sample 2 has the following valid plans: , ; , ; , .
Constraints:
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号