1 /*
2 * poj-1064 Cable master.cpp
3 *
4 * Created on: 2012-2-26
5 * Author: LongDou
6 *
7 *
8 * 二分, 化为整数存储,下界为1(cm),上界为最长绳的长度
9 *
10 */
11 #include<cstdio>
12 using namespace std;
13
14 const double eps = 1e-7; //注意精度
15 const int maxn = 10000 + 10;
16
17 int n, k, cable[maxn];
18
19 int main(){
20 scanf("%d%d", &n, &k);
21 double ftmp;
22 int tmpMax = 0;
23 for(int i=0; i<n; i++){
24 scanf("%lf", &ftmp);
25 cable[i] = int((ftmp+eps) * 100); //精度
26
27 if(cable[i] > tmpMax) tmpMax = cable[i];
28 }
29
30 int up = tmpMax, low = 1, mid = -1, ans = -1;
31 int tmpNum = 0;
32 while(low <= up){
33 mid = (up + low) / 2;
34 tmpNum = 0;
35 for(int i=0; i<n; i++)
36 tmpNum += cable[i] / mid;
37
38 if(tmpNum >= k){
39 if(mid > ans) ans = mid;
40 low = mid + 1;
41 }
42 else
43 up = mid - 1;
44 }
45
46 if(ans < 1)
47 printf("0.00\n");
48 else
49 printf("%.2lf\n", ans * 0.01);
50
51
52 return 0;
53 }