Square inside a triangle

Given three points in the plane that form a triangle, compute the
maximum possible area of a square inscribed in the triangle.

The four vertices of the square must lie on the three sides of the
triangle, with each vertex lying on one of the triangle’s sides.

Input

Input consists of several cases, each with the three points (x, y) that
define a triangle. Each triangle will be non-degenerate and not
right-angled; it will be either acute or obtuse.

Output

For each triangle, print with 4 digits after the decimal point the
maximum area af all the squares inscribed in the triangle. The input
cases have no precision issues.

Problem information

Author: Ivan Geffner
Event: Vint-i-quatrè Concurs de Programació de la UPC - Final
Date: 2026-10-07

Generation: 2026-10-03T14:14:21.577Z

© Jutge.org, 2006–2026.
https://jutge.org
