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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.NoSuchElementException;

public class Main {
	int N,A,B;
	long[] v;
	HashMap<Long,Integer> map;


	public long nCk(int n,int k)
	{
		long r = 1;
		for(long i = 1;i <= k;i++,n--){
			r *= n;
			r /= i;
		}
		return r;
	}

	public void solve() {
		N = nextInt();
		A = nextInt();
		B = nextInt();

		v = new long[N];
		for(int i = 0;i < N;i++){
			v[i] = nextLong();
		}

		Arrays.sort(v);
		for(int i = 0;i < N / 2;i++){
			long tmp = v[i];
			v[i] = v[N-i-1];
			v[N-i-1] = tmp;
		}

		ArrayList<Integer> list = new ArrayList<Integer>();
		double max = 0.0;
		for(int i = A;i <= B;i++){
			long sum = 0;
			for(int j = 0;j < i;j++){
				sum += v[j];
			}
			if(max < sum*1.0/i){
				max = sum*1.0/i;
			}
		}

		for(int i = A;i <= B;i++){
			long sum = 0;
			for(int j = 0;j < i;j++){
				sum += v[j];
			}
			if(Math.abs(max - sum*1.0/i) <= 1e-9){
				list.add(i);
			}
		}

		map = new HashMap<Long,Integer>();
		for(int j = 0;j < N;j++){
			map.put(v[j],map.containsKey(v[j]) ? map.get(v[j]) + 1 : 1);
		}


		long ans = 0;
		for(int i = 0;i < list.size();i++){
			HashMap<Long,Integer> use = new HashMap<Long,Integer>();
			for(int j = 0;j < list.get(i);j++){
				use.put(v[j],use.containsKey(v[j]) ? use.get(v[j]) + 1 : 1);
			}

			long sum = 1;
			for(long key : use.keySet()){
				sum *= nCk(map.get(key),use.get(key));
			}
			ans += sum;
		}
		out.println(String.format("%.09f",max));
		out.println(ans);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}