fork download
  1. #include<bits/stdc++.h>
  2. #define PI acos(-1)
  3. #define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  4. #define ll long long int
  5. #define mem(a,b) memset(a,b,sizeof(a))
  6. #define MX 100005
  7. #define MXX 2000005
  8. //#define s second
  9. //#define f first
  10. #define mod 1000000007
  11. #define inf 1e9
  12. #define eps 1e-15
  13. //int ex[]={1,-1,0,0};
  14. //int wye[]={0,0,1,-1};
  15. using namespace std;
  16. int t;
  17. double l,n,c,an,b,a,tmp,s;
  18. int main()
  19. {
  20. fast();
  21. scanf("%d",&t);
  22. for(int i=1;i<=t;i++){
  23. scanf("%lf%lf%lf",&l,&n,&c);
  24. s=(1+(n*c))*l;
  25. double hi=1e9,lo=0.0,mid;
  26. for(int j=1;j<=100;j++){
  27. mid=(lo+hi)/2.0;
  28. b=((l/2)*(l/2))+(mid*mid);
  29. a=l*l;
  30. tmp=(acos((b+b-a)/(b+b))*sqrt(b));
  31. if(s>tmp) hi=mid;
  32. else lo=mid;
  33. }
  34. tmp=((l/2)*(l/2))+(mid*mid);
  35. tmp=(sqrt(tmp)-mid);
  36. printf("Case %d:%.15lf\n",i,tmp);
  37. }
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty