UPC Contest RankList - 2019 Second stage of my personal training to become strong competition sixteenth field

Title Description

Dew has a set length of S. n One day, he would like to choose k different elements out of the game.
Dew but only two hands, so he must first choose k elements, then come up with a minimum of two of the k element.
In fact, Dew prefer it the second smallest k elements in that, so he'll keep a second set of small value of T g (T). Dew can be obtained at this time c ^ g (T)! Score, where c is a constant,! Denotes factorial.
Now you need to find the Dew k elements selected from the set S, he's expected to score 998 244 353 results modulo.

Entry

Enter the total of the two lines.
The first line of three positive integer n, k, c, respectively, the size of the set S, Dew number of elements to be selected, and a constant c.
The second row of n mutually different positive integers ai, represents an element of the set S. Guarantee .

Export

Output line a non-negative integer Dew desired results 998244353 score modulo.

Sample input

5 3 2
1 2 3 4 5

Sample Output

803628674

 

 

• ideas

N numbers a1, a2, a3, a4, .... (in ascending order), to choose the number k,

The total number of cases is C (n, k) species,

Wherein a2 is the second decimal are C (n-2, k-2) th, a2 is a second small, certainly have a choice a1, a2, and then selected from the remaining (n-2) ri (- K- 2) a

A3 wherein there is a second fractional 2 * C (n-3, k-2) th, a3 is the second smallest, and certainly have to choose only choose a1, a2 i.e. one in both cases, and then from the remaining the (n-3) th selected in (k-2) th

Wherein the second decimal a4 are 3 * C (n-4, k-2) th, a4 is a second small, certainly you have to be used to choose selected from a1, a2, a3, a i.e. three cases, and then from the remaining (n-4) th selected in (k-2) th

...

Each number of cases where an election is

So expectations are selected and then multiplied by the factorial, the final result is

 

 

details of the deal

Modulo division:

 

Modulo index:

 

 

 

 

• Code

 

 

Guess you like

Origin www.cnblogs.com/MMMinoz/p/11200121.html