Triangle Classification
InterviewTime limit1sMemory limit128 MB
For each of T triples of side lengths, output whether it is equilateral, isosceles, scalene, or not a triangle.
- Level
Easy2 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
Ggung learned about triangles at school today. Triangles are grouped by their side lengths.
- An equilateral triangle has three sides of the same length. All three angles are 60 degrees.
- An isosceles triangle has two sides of the same length. Two of its angles are also equal.
- A scalene triangle has three sides of different lengths, and all three angles differ. Some scalene triangles are right triangles.
The math teacher assigned homework: classify a triangle from its three side lengths. Ggung would much rather go play, so do the homework for him.
Input
The first line contains the number of test cases ().
Each of the next lines contains three space-separated integers , , (), the three sides of a triangle.
Output
For each test case print one line in the form Case #x: type, where is the test case number starting at 1 and type is the kind of triangle.
If the three lengths form a triangle, print equilateral, isosceles, or scalene. Otherwise print invalid!. The lengths form a triangle only when the longest side is shorter than the sum of the other two. If the two values are equal, it is not a triangle.