Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.  
  5. double hi,lo,mid,x,y,c,h,ans;
  6. int t,i,j,k,n;
  7. scanf("%d",&t);
  8. for(i=1;i<=t;i++){
  9. scanf("%lf %lf %lf",&x,&y,&c);
  10. lo=0.0;
  11. hi=min(x,y);
  12. while(lo+1e-7<hi){
  13. mid=(lo+hi)/2.0;
  14. h=sqrt(x*x-mid*mid)*sqrt(y*y-mid*mid)/(sqrt(x*x-mid*mid)+sqrt(y*y-mid*mid));
  15. if(h-c>1e-7)lo=mid;
  16. else hi=mid;
  17. }
  18. printf("Case %d: %.10lf\n",i,lo);
  19. }
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement