Problem:
Score : 400 points

Problem Statement

You are given N items.

The value of the i-th item (1 \leq i \leq N) is v_i.

Your have to select at least A and at most B of these items.

Under this condition, find the maximum possible arithmetic mean of the values of selected items.

Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized.

Constraints

1 \leq N \leq 50

1 \leq A,B \leq N

1 \leq v_i \leq 10^{15}

Each v_i is an integer.

Input

The input is given from Standard Input in the following format:

N A B
v_1
v_2
...
v_N

Output

Print two lines.

The first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6}.

The second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.

Sample Input 1

5 2 2
1 2 3 4 5

Sample Output 1

4.500000
1

The mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5.

There is no other way to select items so that the mean of the values will be 4.5, and thus the second line of the output should contain 1.

Sample Input 2

4 2 3
10 20 10 10

Sample Output 2

15.000000
3

There can be multiple ways to select items so that the mean of the values will be maximized.

Sample Input 3

5 1 5
1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996

Sample Output 3

1000000000000000.000000
1

Solution in Scala (2.11.7) (judge verdict: Wrong Answer)

object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    def combinationTable(n: Int): Array[Array[Long]] = {
      val C = Array.fill(n+1, n+1)(1L)
      (2 to n) foreach { i =>
        (1 until i) foreach { j =>
          C(i)(j) = C(i-1)(j-1) + C(i-1)(j)
        }
      }
      C
    }


    // 品物の中で, 大きい順にA個選べば良い？
    // 同じ平均になる選び方が何通りあるか?
    // 最後に取った数と同じものが何個あるか？で決まる？

    val N, A, B = sc.nextInt()

    val C = combinationTable(N)
    val V = Array.fill(N)(sc.nextLong()).sorted(Ordering.Long.reverse)
    val ave = V.take(A).sum / A.toDouble

    println(ave)
    if (V.takeWhile(_ == V(0)).length >= A) {
      val length = Math.min(V.takeWhile(_ == V(0)).length, B)
      println((A to length).foldLeft(0L)((b, n) =>
        b + C(length)(n)
      ))
    } else {
      val pattern = V.dropWhile(_ != V(A-1)).takeWhile(_ == V(A-1))
      println(pattern.length)
    }
  }

}