标签:des style c class blog code
Time
Limit: 2000/1000 MS (Java/Others) Memory Limit:
32768/32768 K (Java/Others) Total Submission(s):
445 Accepted Submission(s): 90
1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<math.h> 4 const double ZERO =1e-8 ; 5 double H,D,V,R; 6 double calc(double r) 7 { 8 double h=R-r; 9 return H*R*R*acos(h/R)/3 -h*H*sqrt(R*R-h*h)*2/3+h*h*h*H/R*log((R+sqrt(R*R-h*h))/h)/3; 10 } 11 int main() 12 { 13 int cases =0; 14 double l,r,mid; 15 scanf("%d",&cases); 16 while(cases--) 17 { 18 scanf("%lf%lf%lf",&H,&D,&V); 19 R=D/2.0; 20 l=0; r=R; 21 while(r-l>=ZERO) 22 { 23 mid=(l+r)/2; 24 if(calc(mid)<V) l=mid; 25 else r=mid; 26 } 27 printf("%.5lf\n",2*R-(l+r)/2.0); 28 } 29 return 0; 30 }
HDUOJ-------2493Timer(数学 2008北京现场赛H题),布布扣,bubuko.com
HDUOJ-------2493Timer(数学 2008北京现场赛H题)
标签:des style c class blog code
原文地址:http://www.cnblogs.com/gongxijun/p/3752525.html