#C11689. Prize Distribution Challenge

    ID: 41032 Type: Default 1000ms 256MiB

Prize Distribution Challenge

Prize Distribution Challenge

In this problem, you are given three integers (K), (L), and (P). Although (K) is provided as an input, it is not used in the calculation. The goal is to determine the number of ways to distribute (L) distinct prizes among (P) participants such that each participant receives at least one prize. In other words, if (L \ge P), compute the number of permutations of (L) items taken (P) at a time, which is given by: [ \frac{L!}{(L-P)!} ] If (L < P), then it is impossible to give each participant a prize, and the answer should be 0.

The input begins with a test case count, followed by that many test cases. For each test case, output the computed value on a new line.

inputFormat

The first line contains an integer (T) representing the number of test cases. Each of the next (T) lines contains three space-separated integers: (K), (L), and (P). Note that (K) is given but does not affect the calculation.

outputFormat

For each test case, print a single integer on a new line, representing the number of valid ways to assign (L) distinct prizes to (P) participants, ensuring every participant receives at least one prize.## sample

4
5 3 2
10 4 3
5 3 4
7 5 5
6

24 0 120

</p>