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)

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define endl '\n'
typedef long long ll;
const int _N = 1e5 + 11;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-7;

ll n, a, b, v[55], ans = 0;
double res = 0.0;

ll C(int n, int k) {
	int a = max(n - k, k);
	int b = min(n - k, k);
	vector <ll> v1, v2, v3, del;
	for (int i = a + 1; i <= n; i++) v1.pb(i);
	for (int i = 2; i <= b; i++) v2.pb(i);
	for (auto x : v2) {
		for (auto &y : v1) {
			if (y % x == 0) {
				y /= x;
				del.pb(x);
				break;
			}
		}
	}
	for (auto x : v2) {
		bool ok = 1;
		for (auto y : del) {
			if (x == y) ok = 0;
		}
		if (ok) v3.pb(x);
	}
	ll N = 1LL, K = 1LL;
	for (auto x : v1) N *= x;
	for (auto x : v3) K *= x;
	return N / K;
}

int main() {
//	boost();	
	freopen("in", "r", stdin);
	scanf("%lld%lld%lld", &n, &a, &b);
//	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) scanf("%lld", &v[i]); //cin >> v[i];
	sort(v + 1, v + n + 1); reverse(v + 1, v + n + 1);
	ll sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += v[i];
		if (a <= i && i <= b) res = max(res, (double)sum / (double)i);
	}
//	cout << res << endl;
	printf("%.6lf\n", res);
	sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += v[i];
		if (a <= i && i <= b) {		
			ll x = 0, y = 0;
			for (int j = 1; j <= i; j++) {
				if (v[i] == v[j]) x += 1;
			}
			for (int j = i + 1; j <= n; j++) {
				if (v[i] == v[j]) y += 1;
			}
			
//			printf("%.7lf %.7lf\n", res, (double)sum / (double)i);
			
			if (abs((double)sum / (double)i - res) < EPS) {
				ans += C(x + y, x);
			}
		}
	} 
	printf("%lld\n", ans);
	return 0;
}