Given a set of
N
elements. The value of the
i
th element (
\(1<=i<=N\)) is
vi sub>
. From this set, at least
A
and no more than
B
elements are selected. Find the maximum possible arithmetic mean of the values of the selected elements. In addition, find the number of ways to select elements so that the average value of the selected elements is maximum.
Input
The first line contains three space-separated integers:
N
(
\(1<=N<=50\)),
A
and
B
(
\(1<=A,B<=N\)). The following
N
lines contain integers
vi
(
\(1<=v_i< =10^{15}\)), one number per line.
Imprint
Output two lines.
The first line should contain the maximum possible arithmetic mean of the values of the selected elements. The conclusion should be considered correct if the absolute or relative error does not exceed
\(10^{-6}\).
The second line should contain the number of ways to select elements so that the average value of the selected elements is maximum.
Examples
# |
Input |
Output |
Explanations |
1 |
5 2 2
1 2 3 4 5
| 4.500000
1 |
The average of the selected items will be the maximum when the fourth and fifth items are selected. Therefore, the first line of the output should contain 4.5.
There is no other way to select elements so that the average is 4.5, and so the second line of the output should contain 1. |
2 |
4 2 3
10 20 10 10
| 15.000000
3 |
There can be multiple ways to select elements so that the average value is maximum. |
3 |
5 1 5
1000000000000000 999999999999999 9999999999999998 999999999999997 999999999999996 |
1000000000000000.000000
1 |
|