Advertisement
a53

BBsecurity_Oficiala

a53
Jan 9th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /// 100 P
  2. #include "iostream"
  3. #include "cmath"
  4. #include "iomanip"
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9. double l, c, h, n;
  10. cin >> n;
  11. for(; n-- ;){
  12. cin >> l >> c >> h;
  13. if(h == l) /// caz in care cablul este intins la maximum.
  14. cout << (int)c << ".00\n";
  15. else if(c / 2 + h == l) /// caz in care cablul atinge pamantul intr-un singur punct.
  16. cout << "0.00\n";
  17. else{ /// restul cazurilor, cu ecuatia catenarei intr-un sistem de coordonate
  18. double a = ((c*c/4)-(l-h)*(l-h)) /(2*(l-h));
  19. double t1 = 2 * a * log(sqrt(((c*c/4))/(a*a)+1) + ((c/2)/a));
  20. cout << fixed << setprecision(2) << t1 << '\n';
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement