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 PHP7 (7.0.15) (judge verdict: Accepted)

<?php
    /*
        Problem URL : http://abc057.contest.atcoder.jp/tasks/abc057_d

        Score  :
        Result :
        Time   : ms
        Memory : KB
     */

    ini_set('error_reporting', E_ALL & ~E_NOTICE);

    // define('DEBUG', true);
    define('DEBUG', false);

    // $a = 0;
    // for ($i = 1; $i <= 50; $i++) {
    //     $a += p(50, $i);
    //     // echo p(50, $i) . PHP_EOL;
    // }
    // printf("ans:%d\n", $a);
    // exit;

    if (DEBUG) {
        $start = microtime(true);
    }
    echo solve();
    if (DEBUG) {
        $t = microtime(true) - $start;
        printf ("Elapsed time: %7.3f sec\n", $t);
    }

    function p($x, $y) {
        $ret = 1;
        for ($i = $x; $i > $x - $y; $i--) {
            // echo "* {$i} / ". ($x - $i + 1) . "\n";
            $ret *= $i;
            $ret /= $x - $i + 1;
        }
        return $ret;
    }

    function solve() {
        $idx = array();
        $maxavg = 0;
        fscanf(STDIN, "%d %d %d\n", $N, $A, $B);
        $v = explode(" ", trim(fgets(STDIN)));
        foreach ($v as $vv) {
            $idx[$vv]++;
        }
        rsort($v);
        // var_dump($v);
        for ($i = $A; $i <= $B; $i++) {
            $tmp = null;
            $posi = 0;
            for ($j = 0; $j < $i; $j++) {
                if (is_null($tmp)) {
                    $tmp = $v[$j];
                }
                if ($tmp != $v[$j]) {
                    $posi = $j;
                    $tmp = $v[$j];
                }
                $total[$i] += $v[$j];
                $last[$i] = $v[$j];
            }
            $ai[$i] = $i;
            $pos[$i] = $posi;
            $avg[$i] = $total[$i] / $i;
            $maxavg = max($avg[$i], $maxavg);
            if (DEBUG) echo "PPPP {$idx[$last[$i]]} X " . ($i - $pos[$i]) . "\n";
            $toori[$i] = p($idx[$last[$i]], $i - $pos[$i]);
            if (DEBUG) echo "toori:{$toori[$i]}\n";
        }
        if (DEBUG) var_dump($total);
        $ans = 0;
        foreach ($total as $k => $v) {
            if (DEBUG) echo "ai:{$ai[$k]} t:{$total[$k]} l:{$last[$k]} a:{$avg[$k]} pos:{$pos[$k]} toori:{$toori[$k]} idx:".$idx[$last[$k]]."\n";
            if ($maxavg == $avg[$k]) {
                $ans += $toori[$k];
            }
        }
        echo $maxavg . PHP_EOL;
        printf("%d\n", $ans);
    }