//============================================================================
// Name : 2833.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <stdio.h>
#include <queue>
using namespace std;
priority_queue<int, vector<int>, greater<int> > qbig;
priority_queue<int> qsmall;
int main() {
int n1, n2, n;
while (1) {
scanf("%d %d %d", &n1, &n2, &n);
if (n == 0) {
break;
}
int data;
long long sum = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &data);
sum += data;
if (i < n1) {
qbig.push(data);
} else {
if (qbig.top() < data) {
qbig.push(data);
qbig.pop();
}
}
if (i < n2) {
qsmall.push(data);
} else {
if (qsmall.top() > data) {
qsmall.push(data);
qsmall.pop();
}
}
}
while (!qbig.empty()) {
sum -= qbig.top();
qbig.pop();
}
while (!qsmall.empty()) {
sum -= qsmall.top();
qsmall.pop();
}
double count = n - n1 - n2;
printf("%.6f\n", sum / count);
}
return 0;
}
poj2833
最新推荐文章于 2022-03-08 09:13:55 发布