fork download
  1. from decimal import Decimal, getcontext
  2. from math import sqrt
  3.  
  4. def getArea(a, b, c):
  5. s = (a + b + c) / Decimal(2.0)
  6. return (s * (s - a) * (s - b) * (s - c)).sqrt()
  7.  
  8. def main():
  9. getcontext().prec = 50
  10. tc = int(input())
  11. for _ in range(tc):
  12. r1, r2, r3 = map(Decimal, input().split())
  13. total = getArea(r1 + r3, r3 + r2, r1 + r2)
  14. lo = Decimal(0)
  15. hi = Decimal(1e20)
  16. for i in range(1, 251):
  17. mid = (lo + hi) / Decimal(2.0)
  18. tri1 = getArea(r1 + mid, r3 + mid, r1 + r3)
  19. tri2 = getArea(r1 + mid, r2 + mid, r1 + r2)
  20. tri3 = getArea(r2 + mid, r3 + mid, r2 + r3)
  21. if (tri1 + tri2 + tri3) >= total:
  22. hi = mid
  23. else:
  24. lo = mid
  25. print("{:.50f}".format(hi))
  26.  
  27. if __name__ == "__main__":
  28. main()
Runtime error #stdin #stdout #stderr 0.16s 26220KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 28, in <module>
  File "./prog.py", line 10, in main
EOFError: EOF when reading a line