#P16811. [蓝桥杯 2026 国 Python A] 课程值班

    ID: 19152 远端评测题 3000ms 512MiB 尝试: 0 已通过: 0 显示难度提高 上传者: 标签>动态规划 DP组合数学2026蓝桥杯国赛

[蓝桥杯 2026 国 Python A] 课程值班

Problem Description

Xiao Lan needs to arrange a duty schedule for teaching assistants (TAs) of a course. The schedule lasts for nn days, and there are mm TAs, numbered from 11 to mm.

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 ii, then they must also be on duty on day i1i - 1 or day i+1i + 1.
  • To avoid excessive fatigue, the same TA cannot be on duty for 33 consecutive days.

The total workload of a schedule is defined as the sum of the duty days of all TAs. That is, if the ii-th TA is on duty for a total of cic_i 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 KK. Please compute how many duty schedules satisfy the requirements. Since the answer may be very large, you only need to output the result modulo 998244353998244353.

Input Format

The first line contains a positive integer TT, representing the number of queries.

The next TT lines each contain three integers n,m,Kn, m, K, representing the number of days the schedule lasts, the number of TAs, and the required total workload, respectively.

Output Format

Output TT 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, n=4,m=2,K=4n = 4, m = 2, K = 4.

Use (A,B)(A, B) to represent a duty schedule, where AA is the set of duty days for TA 11, and BB is the set of duty days for TA 22. 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 99.

Constraints and Assumptions

For 30%30\% of the testdata, 1T31 \le T \le 3, 1n121 \le n \le 12, 1m61 \le m \le 6, 1K241 \le K \le 24.

For 60%60\% of the testdata, 1T51 \le T \le 5, 1n1051 \le n \le 10^5, 1m501 \le m \le 50, 1K2001 \le K \le 200.

For all testdata, 1T51 \le T \le 5, 1n10181 \le n \le 10^{18}, 1m2001 \le m \le 200, 1K8001 \le K \le 800.

Translated by ChatGPT 5