logo AlgoBeat OnlineJudge
登录 注册

#217790. [JAG 2026 Summer Camp #1] Group Strength

内存限制:2048 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

输入格式

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 .

输出格式

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 .

样例

样例输入 1

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

样例输出 1

83.25
280.2
68.0