Right Triangle
InterviewTime limit1sMemory limit128 MB
Read triples of side lengths until 0 0 0, and print right if the squares of the two shorter sides sum to the square of the longest, else wrong.
- Level
Easy2 of 10
- Topics
- Math, Implementation, Sorting, Geometry
- Solved
- No attempts yet
Problem
The ancient Egyptians knew that a triangle with side lengths 3, 4, and 5 is a right triangle. Given the lengths of the three sides of a triangle, decide whether it is a right triangle.
Input
The input consists of several test cases. Each test case is a line with three side lengths, each a positive integer less than .
The input ends with a line containing 0 0 0, which is not a test case and must not be processed.
Output
For each test case, print right if the three sides form a right triangle, and wrong otherwise.