SCPC11D - Egypt

no tags 

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

hide comments
Wumbolo: 2016-07-09 00:30:05

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"

ehabshhadat: 2015-10-08 20:16:34

nice

ALi Ibrahim: 2015-07-26 11:10:47

nice Problem Ali, Keep up the good work my friend :)

karthik1997: 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

shunmugavel: 2015-07-01 11:14:36

easy problem

Dushyant Singh: 2015-01-18 08:02:37

Given test cases will give output as right
3 4 5
5 4 3
4 5 3
8 10 6
6 8 10

:.Mohib.:: 2014-12-22 06:52:24

Easy One.... :)

pvkcse: 2014-05-24 12:49:07

remembered pythagoras theorem...

SHIVAM DIXIT: 2014-04-17 20:27:14

accepted in first attempt :):) take care of case when triangle isnt possible

Last edit: 2014-04-17 20:27:26
Samil Vargas: 2013-12-19 00:16:07

please any one some testcases please i want to know whats wrong with my code.


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