标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2499 Accepted Submission(s):
936
1 #include<stdio.h> 2 #include<iostream> 3 #include<algorithm> 4 #include<math.h> 5 using namespace std; 6 double L[100500]; 7 int a,b,i; 8 bool F(double x) 9 { 10 int sum=0; 11 for(i=0;i<a;i++) 12 sum +=(int)(L[i]/x); 13 return sum >= b; 14 } 15 void ww() 16 { 17 double l=0,r=1100000,mid; 18 while(r-l>1e-10) 19 { 20 mid=(r+l)/2; 21 if(F(mid)) 22 l=mid; 23 else 24 r=mid; 25 } 26 r=(int)(r*100)/100.0; 27 printf("%.2f\n",r); 28 } 29 int main() 30 { 31 scanf("%d%d",&a,&b); 32 for(i=0;i<a;i++) 33 scanf("%lf",&L[i]); 34 ww(); 35 36 return 0; 37 }
标签:
原文地址:http://www.cnblogs.com/Eric-keke/p/4690657.html