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 Rust (1.15.1) (judge verdict: Accepted)

// https://atcoder.jp/contests/abc021/submissions/5777748
// ↓
use std::io::prelude::*;

fn input<T>() -> T
    where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
// ↑
// https://atcoder.jp/contests/abc021/submissions/5777748

struct C {
    // c[n][k] -> nCk
    c: Vec<Vec<usize>>
}
impl C {
    fn new(max: usize) -> C {
        let mut c = vec![vec![0; max+2]; max+2];
        c[0][0] = 1;
        for i in 0..max+1 {
            for j in 0..i+1 {
                c[i+1][j] += c[i][j];
                c[i+1][j+1] += c[i][j];
            }
        }
        C {c:c}
    }
}

fn main() {
    let n = input::<usize>();
    let a = input::<usize>();
    let b = input::<usize>();
    let mut v = (0..n)
        .map(|_| input::<usize>())
        .collect::<Vec<_>>();

    v.sort();
    v.reverse();
    let max_ave = v[0..a]
        .iter()
        .sum::<usize>() as f64 / a as f64;
    let mut a_th_val_num = 0;
    let mut a_th_val_pos = 0;
    for i in 0..n {
        if v[i] == v[a-1] {
            a_th_val_num+=1;
            if i < a {
                a_th_val_pos+=1;
            }
        }
    }

    let mut cnt = 0;
    let c = C::new(51);
    if a_th_val_pos == a {
        for a_th_val_pos in a..b+1 {
            cnt += c.c[a_th_val_num][a_th_val_pos];
        }
    } else {
        cnt += c.c[a_th_val_num][a_th_val_pos];
    }
    println!("{}", max_ave);
    println!("{}", cnt);
}


#[allow(unused_doc_comments)]
#[cfg(test)]
mod tests {
    #[test]
    fn tester() {
        let inputs = [
("
5 2 2
1 2 3 4 5
", "
4.500000
1
"),

("
4 2 3
10 20 10 10
", "
15.000000
3
"),

("
5 1 5
1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996
","
1000000000000000.000000
1
"),

("
50 1 50
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
","
1.000000
1125899906842623
"),
        ];

        for (input, expected) in inputs.iter() {
            call(input, expected.to_string());
        }
    }

    fn call<T: AsRef<str>>(input: T, expected: String) {
        use std::process::{Command, Stdio};
        use std::io::{Read, Write};

		/// same as
        ///  ```sh
        ///  actual=$(echo "$input" | cargo run)
        ///  ```
        let mut cmd_ls = Command::new("echo")
            .arg(input.as_ref())
            .stdout(Stdio::piped())
            .spawn()
            .unwrap();
        let mut cmd_grep = Command::new("cargo")
            .arg("run")
            .stdin(Stdio::piped())
            .stdout(Stdio::piped())
            .spawn()
            .unwrap();

        if let Some(ref mut stdout) = cmd_ls.stdout {
            if let Some(ref mut stdin) = cmd_grep.stdin {
                let mut buf: Vec<u8> = Vec::new();
                stdout.read_to_end(&mut buf).unwrap();
                stdin.write_all(&buf).unwrap();
            }
        }

        let res = cmd_grep.wait_with_output().unwrap().stdout;

        let res_string: String = String::from_utf8(res.to_vec()).unwrap();

        // convert '\n' into space
        let actual = res_string
            .replace("\n", " ")
            .trim_end_matches(" ")
            .trim_start_matches(" ")
            .to_owned();
        let expected = expected
            .replace("\n", " ")
            .trim_end_matches(" ")
            .trim_start_matches(" ")
            .to_owned();

        // split into a vector
        let actual = actual
            .split(" ")
            .map(|s| s.parse::<f64>().unwrap())
            .collect::<Vec<_>>();
        let expected = expected
            .split(" ")
            .map(|s| s.parse::<f64>().unwrap())
            .collect::<Vec<_>>();

        assert_eq!(actual, expected);
    }
}