Advertisement
a53

BBSecurity

a53
Jan 8th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n;
  9. cin>>n;
  10. int L,c,h;
  11. while(n--)
  12. {
  13. cin>>L>>c>>h;
  14. if(h==L)
  15. {
  16. cout<<c<<".00\n";
  17. continue;
  18. }
  19. double p=(double)(L-h);
  20. double q=(double)c*0.5,a,y,x;
  21. if(p==q)
  22. {
  23. cout<<"0.00\n";
  24. continue;
  25. }
  26. a=(double)((q+p)*(q-p))/(double)(2*p);
  27. y=q/a;
  28. x=2*a* asinh(y);
  29. if(x==(int)x)
  30. cout<<x<<".00\n";
  31. else
  32. cout<<fixed<<setprecision(2)<<x<<'\n';
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement