1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
// PA2025, @mjm, r2a-egz

#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
using ull = unsigned long long;
inline int nextInt() { int n; scanf("%d", &n); return n; }
inline int myMin(int a, int b) { return a <= b ? a : b; }
inline ull myMax(ull a, ull b) { return a >= b ? a : b; }

const int N = 50000 + 9;
const ull ONE = 1;
const ull DIV = ONE << 32;
ull p[N];
ull x[N];
ull y[N];
ull pow10[10];

ull solve() {
	int n = nextInt();
	int t = nextInt();
	int cnt0 = 0;
	int cnt1 = 0;
	for (int i = 0; i < n; ++i) {
		char s[64];
		scanf("%s", s);
		int be = 2;
		int en = 0;
		while (s[en]) ++en;
		if (s[0] == '1') {
			++cnt1;
			--i;
			--n;
			--t;
			continue;
		}
		if (en == 1) {
			++cnt0;
			--i;
			--n;
			continue;
		}
		p[i] = 0;
		for (int j = be; j < en; ++j)
			p[i] = p[i] * 10 + (s[j] - '0');
		if (p[i] == 0) {
			++cnt0;
			--i;
			--n;
			continue;
		}
		p[i] <<= 32;
		p[i] /= pow10[en - be];
	}
	if (t <= 0) return DIV;
	if (t > n) return 0;
	sort(p, p + n, greater<ull>());
	if ((t % 2) != (n % 2)) --n;

	int k = (n - t) / 2; // max error count
	ull res = 0;
	x[0] = DIV;

	for (int i = 0; i < n; ++i) {
		int kk = myMin(i + 1, k);
		ull* cur;
		ull* nex;
		if (i % 2 == 0) {
			cur = x;
			nex = y;
		}
		else {
			cur = y;
			nex = x;
		}
		int kmax = -1;
		if (i + 1 >= t) kmax = (i + 1 - t) / 2;
		ull sumCur = 0;
		nex[0] = 0;
		for (int j = 0; j < kk; ++j) {
			ull tmp = (cur[j] * p[i]) >> 32;
			nex[j] += tmp;
			if (j <= kmax) sumCur += nex[j];
			nex[j + 1] = cur[j] - tmp;
		}
		if (i >= k) {
			nex[k] += (cur[k] * p[i]) >> 32;
			if (k <= kmax) sumCur += nex[k];
		}
		//printf("i: %d, sumCur: %lf\n", i, sumCur);
		res = myMax(res, sumCur);
	}

	return res;
}

int main() {
	pow10[0] = 1;
	for (int i = 1; i < 10; ++i) pow10[i] = pow10[i - 1] * 10;

	ull res = solve();
	double dres = res;
	dres /= DIV;
	printf("%.9lf\n", dres);
	return 0;
}