Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// https://www.youtube.com/watch?v=l_ffdarcJiQ
- #include <cstdio>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n;
- scanf("%d",&n);
- int L,c,h;
- while(n--)
- {
- scanf("%d %d %d",&L,&c,&h);
- if(h==L)
- {
- printf("%d.00\n",c);
- continue;
- }
- double p=(double)(L-h);
- double q=(double)c*0.5,a,y,x;
- if(p==q)
- {
- printf("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)
- printf("%d.00\n",(int)x);
- else
- printf("%4.2f\n",x);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement