SCPC11D - Egypt

A long time ago, the Egyptians figured out that a triangle with sides of length 3, 4, and 5 had a right angle as its largest angle. You must determine if other triangles have a similar property.

Input

Input represents several test cases, followed by a line containing 0 0 0. Each test case has three positive integers, less than 30,000, denoting the lengths of the sides of a triangle.

Output

For each test case, a line containing "right" if the triangle is a right triangle, and a line containing "wrong" if the triangle is not a right triangle.

Example

Input:
6 8 10
25 52 60
6 8 10 25 52 60 5 12 13 0 0 0
5 12 13
0 0 0
Output: right wrong right

Added by:Ali Arous
Date:2011-10-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Syrian Collegiate Programming Contest 2011

hide comments
2016-07-09 00:30:05 Wumbolo
you don't need to take care of cases when a triangle isn't possible. only pythagorean theorem needed.
From https://en.wikipedia.org/wiki/Pythagorean_theorem#Converse, "For any three positive numbers a, b, and c such that a2 + b2 = c2, there <b>exists</b> a triangle with sides a, b and c"
2015-10-08 20:16:34
nice
2015-07-26 11:10:47 ALi Ibrahim
nice Problem Ali, Keep up the good work my friend :)
2015-07-14 20:03:25
very easy one if we take care about the side possibilities of a triangle and if we know pythagoreas thorem :p 0.00s ac in 1st go
2015-07-01 11:14:36
easy problem
2015-01-18 08:02:37 Dushyant Singh
Given test cases will give output as right
3 4 5
5 4 3
4 5 3
8 10 6
6 8 10
2014-12-22 06:52:24 :.Mohib.:
Easy One.... :)
2014-05-24 12:49:07 pvkcse
remembered pythagoras theorem...
2014-04-17 20:27:14 SHIVAM DIXIT
accepted in first attempt :):) take care of case when triangle isnt possible

Last edit: 2014-04-17 20:27:26
2013-12-19 00:16:07 Samil Vargas
please any one some testcases please i want to know whats wrong with my code.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.