#include<iostream>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
int main()
{
    struct qcmp
    {
        bool operator()(const double &a, const double&b)
        {
            return a < b;
        }
    };
    while (1)
    {
        int n1, n2, n;
        scanf("%d%d%d", &n1, &n2, &n);
        if (n1 == 0 && n2 == 0 && n == 0)break;
        priority_queue<double, vector<double>, qcmp>grade;
        for (int i = 0; i < n; i++)
        {
            double temp;
            scanf("%lf", &temp);
            grade.push(temp);
        }
        double sum = 0;
        for (int i = 0; i < n; i++)
        {
            if (i < n1)grade.pop();
            else
                if (i + n2 < n)
                {
                    sum += grade.top();
                    grade.pop();
                }
        }
        double ave = sum / (n - n1 - n2);
        printf("%.6f\n", ave);
    }
}

 c

 

 

#include<stdio.h>
int main()
{
    int n1, n2, n,i,j,temp;
    double sum = 0,ave = 0;
    while (scanf("%d%d%d", &n1, &n2, &n) != EOF)
    {
        //printf("%d%d%d\n", n1, n2, n);
        if (n1 == 0 && n2 == 0 && n == 0)break;
        double *a = (double*)malloc(n * sizeof(double));
        for (i = 0; i < n; i++)
        {
            scanf("%lf", &a[i]);
            //printf("%d\n", a[i]);
        }
        for (i = 0; i < n; i++)
        {
            for (j = i + 1; j < n; j++)
            {
                if (a[i] < a[j])
                {
                    temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }
        for (i = n1; i < n - n2; i++)
        {
            sum += a[i];
        }
        ave = sum / (n - n1 - n2);
        //printf("%f\n", sum);
        printf("%.6f\n", ave);
    }
}