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 (GCC 5.4.1) (judge verdict: Accepted)

#include<stdio.h>

long long temp[51];
//Combination Table
long long C[51][51];//C[n][k] -> nCk

void comb_table(int N);
void MergeSort_re(long long x[],int left,int right);

int main(void){
  int N,A,B,i,same_value_num,same_value_pos;
  long long value[51],ans=0;
  double ave_max=0;
  scanf("%d %d %d",&N,&A,&B);
  for(i=0;i<N;i++) scanf("%lld",&value[i]);
  MergeSort_re(value,0,N-1);
  comb_table(51);
  for(i=0;i<A;i++){
    ave_max+=value[i];
  }
  ave_max/=A;
  printf("%f\n",ave_max);
  same_value_num=0;
  same_value_pos=0;
  for(i=0;i<N;i++){
    if(value[A-1]==value[i]){
      same_value_num++;
      if(i<A){
        same_value_pos++;
      }
    }
  }
  if(value[0]!=value[A-1]){
    ans=C[same_value_num][same_value_pos];
  }else{
    //same_value+=A-1;
    for(i=A;i<=B;i++){
      ans+=C[same_value_num][i];
      //printf("%d\n",ans);
    }
  }
  //printf("%d\n",same_value_num);
  printf("%lld\n",ans);
  return 0;
}


void comb_table(int N){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<=i;j++){
      if(j==0 || j==i){
        C[i][j]=1;
      }else{
        C[i][j]=C[i-1][j-1]+C[i-1][j];
      }
    }
  }
}



void MergeSort_re(long long  x[],int left,int right){
  int mid,i,j,k;
  if(left >= right) return;
  mid = (left+right)/2;
  MergeSort_re(x,left,mid);
  MergeSort_re(x,mid+1,right);

  for(i=left;i<=mid;i++) temp[i] = x[i];
  for(i=mid+1,j=right;i<=right;i++,j--) temp[i]=x[j];

  i=left;
  j=right;

  for(k=left;k<=right;k++){
    if(temp[i] >= temp[j]) x[k] = temp[i++];
    else x[k] = temp[j--];
  }
}