Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int t, i;
  7. double a, b,c,r;
  8. scanf("%d", &t);
  9. double theta;
  10. for(i=1;i<=t;i++)
  11. {
  12. scanf("%lf %lf %lf", &a, &b, &c);
  13.  
  14. double s = a+b*c*a;
  15. //if(s>a*2.0)s=a*2.0;
  16.  
  17. double l=0;
  18. double h=a*a;
  19. for(int j=0;j<100;j++){
  20. r=(l+h)/2.0;
  21. theta = s/r;
  22. //printf("%lf %lf %lf \n",theta,l,h);
  23. double f=2*r*sin(theta/2);
  24. if(f>a){
  25. h=r;
  26. }
  27. else
  28. l=r;
  29.  
  30. }
  31. double fi=r-r*cos(theta/2);
  32. printf("Case %d: %.10lf\n", i,fi );
  33.  
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement