|
- #include <algorithm>
- #include <iostream>
- #include <cmath>
- #include <cstring>
- #include <map>
- #include <string>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <cstdio>
- using namespace std;
- int n,k;
- double a[10100],zuo,you;
- char s[100];
- long long check(double x)
- {
- long long all=0;
- for(int i=1;i<=n;i++)
- all+=floor(a[i]/x);
- return all;
- }
- int main()
- {
- scanf("%d%d",&n,&k);
- for(int i=1;i<=n;i++)
- scanf("%lf",&a[i]),you+=a[i];
- while(fabs(zuo-you)>0.0001)
- {
- double mid=(zuo+you)/2;
- if(check(mid)>=k) zuo=mid;
- else you=mid;
- }
- sprintf(s+1,"%.3f",zuo);
- s[strlen(s+1)]='\0';
- printf("%s",s+1);
- return 0;
- }
复制代码 |
|