Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- int L,c,h;
- while(n--)
- {
- cin>>L>>c>>h;
- if(h==L)
- {
- cout<<c<<".00\n";
- continue;
- }
- double p=(double)(L-h);
- double q=(double)c*0.5,a,y,x;
- if(p==q)
- {
- cout<<"0.00\n";
- continue;
- }
- a=(double)((q+p)*(q-p))/(double)(2*p);
- y=q/a;
- x=2*a* asinh(y);
- if(x==(int)x)
- cout<<x<<".00\n";
- else
- cout<<fixed<<setprecision(2)<<x<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement