#P17536. [JAG 2026 Summer Camp #1] Group Strength
[JAG 2026 Summer Camp #1] Group Strength
Problem Description
There are students in a class. Student has an ability value of .
The teacher will divide the students into exactly groups. Each student must belong to exactly one group, and each group must contain at least one student.
The strength of a group is defined as the average of the ability values of the students in that group. The teacher wants to maximize the sum of the strengths of the groups.
Find the maximum possible sum of the strengths of the groups.
Input Format
The input consists of multiple test cases in the following format.
T
case_1
case_2
...
case_T
Each test case is given in the following format.
N K
A_1 A_2 ... A_N
The first line contains an integer (), the number of test cases.
The first line of each test case contains two integers and (), the number of students and the number of groups, respectively.
The second line of each test case contains integers (), where represents the ability value of student .
The sum of over all test cases does not exceed .
Output Format
For each test case, print the maximum possible sum of the strengths of the groups on a separate line. Your answer will be considered correct if its absolute or relative error does not exceed .
3
6 3
23 5 41 12 9 30
9 5
37 4 91 18 52 11 73 26 45
7 4
17 17 17 17 17 17 17
83.25
280.2
68.0