Python 3, (削除) 89 (削除ここまで) 87 bytes
lambda a,b,c:g(a,b,c)+g(a,c,b)+g(b,c,a)
g=lambda a,b,c:((c*c-(a-b)**2)/a/b)**.5*(a+b+c)
###How We can see that each side of the hexagon is the base of an isosceles triangle, whose vertex angle is an angle of the original triangle. For example:
- \$C_aC_b\$ is the base of \$CC_aC_b\$ - an isosceles triangle with leg \$c\$ and vertex angle \$\widehat{C}\$.
- \$A_bB_a\$ is the base of \$CA_bB_a\$ - an isosceles triangle with leg \$a+b\$ and vertex angle \$\widehat{C}\$.
Given the leg \$l\$ and vertex angle \$\theta\$ of an isosleces triangle, the base is calculated as: $$l\sqrt{2-2\cos{\theta}}$$ Consider 2 opposites side of the hexagon, says \$C_aC_b\$ and \$A_bB_a\$. Since their corresponding triangles have the same vertex angle, their total length is: $$c\sqrt{2-2\cos{\widehat{C}}}+(a+b)\sqrt{2-2\cos{\widehat{C}}}$$$$=(a+b+c)\sqrt{2-2\cos{\widehat{C}}}$$ Then the perimeter of the hexagon is the sum of 3 opposite pairs: $$(a+b+c)\left(\sqrt{2-2\cos{\widehat{A}}}+\sqrt{2-2\cos{\widehat{B}}}+\sqrt{2-2\cos{\widehat{C}}}\right)$$ The cosine of an angle can be calculated from the sides of the triangle: $2ドル-2\cos{\widehat{C}}=\frac{c^2-(a-b)^2}{ab}$$ Thus, the final formula for the hexagon's perimeter is: $$(a+b+c)\left(\sqrt{\frac{a^2-(b-c)^2}{bc}}+\sqrt{\frac{b^2-(a-c)^2}{ac}}+\sqrt{\frac{c^2-(a-b)^2}{ab}}\right)$$
- 8.4k
- 1
- 14
- 40