#P10410. 「QFOI R2」寺秋山霭苍苍
「QFOI R2」寺秋山霭苍苍
Background
Formulas that may be used in this problem:
Distance between two points: the distance between and is .
Heron's formula: if the side lengths of a triangle are , let the semiperimeter be , then the area of the triangle is .
Problem Description
Little R is a cute girl, but she is very bad at geometry, so she asks you to help with this geometry problem.
In the Cartesian plane, there is a with vertices $\textrm{A}(x_1,y_1),\textrm{B}(x_2,y_2),\textrm{C}(x_3,y_3)$.
For a real number , choose points on sides respectively, such that $\frac{|\textrm{AF}|}{|\textrm{AB}|}=\frac{|\textrm{BD}|}{|\textrm{BC}|}=\frac{|\textrm{CE}|}{|\textrm{CA}|}=p$. Then is called the "-ratio triangle" of .
Please choose a real number in the range to minimize the area of the "-ratio triangle" of . You need to output this minimum area.
Input Format
One line with eight real numbers .
Output Format
One line with one real number , representing the minimum area.
Your output is considered correct if and only if its absolute or relative error compared to the standard answer does not exceed .
0.40 0.60 0.00 0.00 4.00 0.00 1.00 5.00
2.500000000000
0.20 0.40 0.00 0.00 4.00 0.00 1.00 5.00
2.800000000000
Hint
Explanation for Sample
It can be proven that the area is minimized when , and the minimum area is .

Explanation for Sample
It can be proven that the area is minimized when , and the minimum area is .

Scoring
This problem is judged using a Special Judge.
Your output is considered correct if and only if its absolute or relative error compared to the standard answer does not exceed .
Constraints
This problem uses bundled testdata. Only by passing all test points in a subtask and all dependent subtasks can you get the corresponding score.
For all testdata: , . The input is guaranteed to form a triangle. For every real number in the input, the number of digits after the decimal point does not exceed .
- Subtask 1 ( points): .
- Subtask 2 ( points): .
- Subtask 3 ( points): . Depends on Subtask 2.
- Subtask 4 ( points): no special constraints. Depends on Subtasks 1, 2, and 3.
Hint
Formulas that may be used in this problem:
Distance between two points: the distance between and is .
Heron's formula: if the side lengths of a triangle are , let the semiperimeter be , then the area of the triangle is .
Translated by ChatGPT 5