#K59877. Prize Distribution

    ID: 30962 Type: Default 1000ms 256MiB

Prize Distribution

Prize Distribution

You are given the total prize pool, the number of participants, and the top K competitors (by score) for each test case. Your task is to distribute the total prize pool among the top K competitors proportionally to their scores. The prize for a competitor is computed as:

\( prize_i = \frac{score_i}{\sum_{j=1}^{K} score_j} \times total\_prize\_pool \)

The scores are provided for all participants, and you must select the top K scores, sort them in descending order, and then compute & output the prizes for these competitors formatted to two decimal places.

Note: All input is read from standard input (stdin) and output should be printed to standard output (stdout).

inputFormat

The input starts with an integer T representing the number of test cases. For each test case, there are two lines:

  • The first line contains three integers: N (number of participants), K (number of top competitors to reward) and total_prize_pool.
  • The second line contains N integers representing the scores of the participants.

All input is provided via standard input.

outputFormat

For each test case, output a single line containing the prizes for the top K competitors, separated by a single space. Each prize value must be formatted to exactly two decimal places. Output is printed via standard output.

## sample
1
5 3 1500
100 200 300 400 500
625.00 500.00 375.00