#P16811. [蓝桥杯 2026 国 Python A] 课程值班
[蓝桥杯 2026 国 Python A] 课程值班
Problem Description
Xiao Lan needs to arrange a duty schedule for teaching assistants (TAs) of a course. The schedule lasts for days, and there are TAs, numbered from to .
Each day, you may assign any number of TAs to be on duty. The entire schedule must satisfy the following requirements:
- Each TA must be on duty at least once.
- For easier handover, if a TA is on duty on day , then they must also be on duty on day or day .
- To avoid excessive fatigue, the same TA cannot be on duty for consecutive days.
The total workload of a schedule is defined as the sum of the duty days of all TAs. That is, if the -th TA is on duty for a total of days, then the total workload is:
$$\begin{aligned} c_1 + c_2 + \dots + c_m \end{aligned}$$Now the total workload is required to be exactly . Please compute how many duty schedules satisfy the requirements. Since the answer may be very large, you only need to output the result modulo .
Input Format
The first line contains a positive integer , representing the number of queries.
The next lines each contain three integers , representing the number of days the schedule lasts, the number of TAs, and the required total workload, respectively.
Output Format
Output lines, each containing one integer representing the answer to the corresponding query.
4
4 2 4
5 2 6
6 1 4
7 2 8
9
8
3
36
Hint
Sample Explanation
For the first query, .
Use to represent a duty schedule, where is the set of duty days for TA , and is the set of duty days for TA . All schedules that satisfy the requirements are:
$$\begin{aligned} & ((1, 2), (1, 2)), ((1, 2), (2, 3)), ((1, 2), (3, 4)), \\ & ((2, 3), (1, 2)), ((2, 3), (2, 3)), ((2, 3), (3, 4)), \\ & ((3, 4), (1, 2)), ((3, 4), (2, 3)), ((3, 4), (3, 4)). \end{aligned}$$Therefore, the answer is .
Constraints and Assumptions
For of the testdata, , , , .
For of the testdata, , , , .
For all testdata, , , , .
Translated by ChatGPT 5