A structural workshop cuts three metal rods for every brace kit it ships and welds them into a triangular brace. Before shipping, quality control must classify the shape of each kit from its three rod lengths.
For each kit, first check whether the three rods can actually be welded into a non-degenerate triangle: this requires the sum of the two shorter lengths to be strictly greater than the longest length. If that check fails, the kit is classified as forming no valid triangle. Otherwise, classify the kit by how many of its rod lengths are equal: all three equal is one class, exactly two equal is a second class, and all three different is a third class.
n lines, one per kit in input order, each containing exactly one of the following labels: Equilateral, Isosceles, Scalene, or Not A Triangle.
Example 1
Input
2 5 5 5 2 2 5
Expected
Equilateral Not A Triangle
Explanation
Kit 1 has all three lengths equal (5, 5, 5), so it is Equilateral. Kit 2 has lengths 2, 2, 5: the two shorter lengths sum to 2 + 2 = 4, which is not strictly greater than the longest length 5, so the rods cannot form a triangle at all — Not A Triangle.
Example 2
Input
3 3 4 5 4 4 7 6 7 8
Expected
Scalene Isosceles Scalene
Explanation
Kit 1 (3,4,5): 3 + 4 = 7 > 5, a valid triangle with all three lengths distinct, so Scalene. Kit 2 (4,4,7): 4 + 4 = 8 > 7, a valid triangle with exactly two equal lengths, so Isosceles. Kit 3 (6,7,8): 6 + 7 = 13 > 8, a valid triangle with all three lengths distinct, so Scalene.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →