Given the measures of two of the interior angles of a triangle (x
and y
; the other angle can be easily calculated with 180 - x - y
), draw a line segment that cuts this triangle into two isosceles triangles. You need to output the angle measures of both of your triangles.
However, because the base angles are the same, you only need to output the list [apex angle, base angle]
of the divided triangles for both of the isosceles triangles. You can output the divided triangles in any order.
An example
Say your input is 100, 60.
Let's take a look at the complete triangle first. The triangle looks approximately like this.
100
60 20
Now we try to divide one of the angles such that two divided triangles are both isosceles triangles.
100
(40,20) 20
Now our bottom triangle is an isosceles triangle, since both of the base angles
of the bottom triangle are 20. The angle measures of the bottom triangle
looks approximately like this.
140
20 20
Now, is the top triangle an isosceles triangle?
100
40
40
It is an isosceles triangle, because two of the angle measures are 40.
Therefore, for [100, 60], you need to output [[100, 40], [140, 20]].
Example cases
[20, 40] -> [[140, 20], [100, 40]]
[45, 45] -> [[90, 45], [90, 45]]
[36, 72] -> [[108, 36], [36, 72]]
[108, 36] -> [[108, 36], [36, 72]]
[44, 132] -> [[92, 44], [4, 88]]
Specifications
- You can always assume that the triangle is dividable into two isosceles triangles.
- You can output one of the many solutions of the cases; for example, you can also output
[20, 40] -> [[100, 40], [20, 80]]
for the first test case.
[20, 40] -> [[140, 20], [100, 40]]
for the first test case? \$\endgroup\$[36, 72] -> [108, 36], [36, 72]
\$\endgroup\$