Write a program which prints the central coordinate $(px, py)$ and the radius $r$ of a…
- User
Write a program which prints the central coordinate and the radius of a circumscribed circle of a triangle which is constructed by three points , and on the plane surface.
Assistant
pythonn = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a1 = x1 - x2 b1 = y1 - y2 c1 = (x1**2 + y1**2 - x2**2 - y2**2) / 2 a2 = x2 - x3 b2 = y2 - y3 c2 = (x2**2 + y2**2 - x3**2 - y3**2) / 2 D = a1 * b2 - a2 * b1 x = (c1 * b2 - c2 * b1) / D y = (a1 * c2 - a2 * c1) / D r = ((x - x1)**2 + (y - y1)**2)**0.5 print("{0:.3f} {1:.3f} {2:.3f}".format(x, y, r))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.