F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Ball

Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 51    Accepted Submission(s): 7


Problem Description
There are $n$ grooves distributed on a slope evenly. We index the highest groove with $n$, while the lowest is $1$. If we choose a number $i$, let a ball fall freely over the $i$th groove, three different situations may happen. If the $i$th groove is empty, then the ball will occupy it. If the $i$th groove is already occupied, the ball will roll down and occupy the first empty groove. If all the grooves below the $i$th groove are occupied, the ball will fall out of the slope.

Now Lucida has $m$ balls. He wondered how many different ways for him to throw these balls such that there are exactly $k$ of them falling out of the slope.

A way to throw these m balls can be represented by a sequence p($\{p_1,p_2,...,p_n\}$, $1\leq p_i\leq n$). $p_i$ means that the $i$th ball is fall freely over the $p_i$ groove.

Two ways are considered the same if the sequence $p$ is the same.
 

Input
This problem contains multiple test cases.

The first line contains a single integer $T$ ($1\leq T \leq 1000$).

The following $T$ lines each contains three integers $n, m, t$ ($1 \leq n\leq 500$,$1\leq m\leq 1000$, $0\leq t\leq 500$, $t < m \leq n + t$), the number of grooves, and the number of balls.
 

Output
For each test case, output one line contains one integer indicating the answer.

Since the answer can be very large, you only need to output the answer modulo $998244353$.
 

Sample Input
1 3 2 0
 

Sample Output
8
 

Hint

For the sample, there are 3 grooves in total. We throw two balls and none of them falls out of the slope.

There are 9 different ways to throw the balls and the only way that causes one of them to fall is to throw both of them over the first groove.

So the answer will be 9-1=8.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 05:28:58, Gzip enabled