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 C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
// #define INF 9e+18

/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

// int dx[] = {-1, 0, 1, 0};
// int dy[] = {0, -1, 0, 1};
int dx[] = {-1, 0, 1};
int dy[] = {-1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


class PascalTriangle {
private:
    int N;
    vector<vector<long long> > comb;
public:
    PascalTriangle(int n) : N(n), comb(n+1,vector<long long>(n+1,0)) {
        rep(i,N+1)rep(j,i+1){
            if(j==0 or j==i){
                comb[i][j] = 1LL;
            }else{
                comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
            }
        }
    }

    long long get(int a,int b) {
        return comb[a][b];
    }
};

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Ciniii(N, L, R);
    vector<long long> v(N), fact(51, 1);
    rep(i, 50) fact[i + 1] *= fact[i] * (ll)(i + 1);
    rep(i, N) cin >> v[i];
    sort(All(v), greater<long long>());
    double mean = 0;
    rep(i, L) mean += v[i];
    mean /= L;
    cout << mean << nn;
    int notSelectedLowestNumberCount = 0;
    int selectedLowestNumberCount = 0;
    int totalLowestNumberCount = 0;
    int countNumber = v[L - 1];
    for (int i = L; i < N; i++) {
        if (v[i] == countNumber) notSelectedLowestNumberCount++;
    }
    rep(i, N) if (v[i] == countNumber) totalLowestNumberCount++;
    selectedLowestNumberCount = totalLowestNumberCount - notSelectedLowestNumberCount;
    long long ans = 0;
    PascalTriangle ps = PascalTriangle(N);
    if (countNumber != v[0]) {
        ans += ps.get(totalLowestNumberCount,selectedLowestNumberCount);
    } else {
        for (int i = L; i <= R ; i++) {
            ll p = i; // tolownum C p を計算
            if (p > totalLowestNumberCount)
                break;
            ll numerator = 1, denominator = 1;
            numerator = fact[totalLowestNumberCount];
            denominator = fact[p] * fact[totalLowestNumberCount - p];
            ans += ps.get(totalLowestNumberCount,p);
        }
    }
    cout << ans << nn;
    return 0;
}