Advertisement
a53

BBsecurity_cstdio

a53
Jan 9th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. /// https://www.youtube.com/watch?v=l_ffdarcJiQ
  2. #include <cstdio>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n;
  9. scanf("%d",&n);
  10. int L,c,h;
  11. while(n--)
  12. {
  13. scanf("%d %d %d",&L,&c,&h);
  14. if(h==L)
  15. {
  16. printf("%d.00\n",c);
  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. printf("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. printf("%d.00\n",(int)x);
  31. else
  32. printf("%4.2f\n",x);
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement