Advertisement
nooobiiee

Untitled

Mar 21st, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. double h1,h2,d,x;
  6. int t;
  7. scanf("%d",&t);
  8. while(t--)
  9. {
  10. scanf("%lf%lf%lf",&h1,&h2,&d);
  11.  
  12. x = h1*d / (h1+h2);
  13.  
  14. if(h1==0 && h2==0)
  15. {
  16. printf("%.4lf %.4lf\n",d/2,d/2);
  17. }
  18. else
  19. {
  20. printf("%.4lf %.4lf\n",sqrt(h1*h1+x*x),sqrt((h2*h2)+(d-x)*(d-x)));
  21. }
  22.  
  23. }
  24. return 0;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement