Editorial for Appleby Contest '20 P1 - Terrific Triangles
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
For the first subtask, there are only two types of triangles. Thus, it suffices to only check if the triangle is a right angle using the Pythagorean Theorem. If not, the triangle can only be obtuse.
Subtask 2
Notice that if the triangle is acute, for hypotenuse and side , ; if the triangle is obtuse, .
The intuition comes from fixing the length of the two shorter sides. Starting from a right triangle, if the angle between and decreases, the length hypotenuse also decreases, and vice versa.
Using this fact, we can simply solve for the type of triangle by testing it against the aforementioned inequalities.
Comments