All submissions for this problem are available.
Board has decided to introduce TRIPLES as a part of their Curriculum of High
School. They believe this will make it easier for students to learn Co-ordinate
Geometry and Calculus easily.
of the form a,b,c represents
a right angled triangle with Base = a; Height = b; Hypotenuse = C. Hence any
triple represents an angle A such that cosA = a/c.
A Triple is called
a Prime Triple if its elements are whole number and have no common factor. For example
(3, 4, 5) and (24, 7, 25) are Prime Triples. However, (6, 8 10) is not because
2 is a common Factor.
basic Triple Arithmetic includes addition of Angles of Triple, i.e. if a1,a2,a3
define angle A and b1,b2,b3 define angle B then you need to find Prime Triple corresponding to angles
A+B or A-B.
Input contains a number of test
cases. Each test case contains 3 lines.
First Line contains either ‘+’ or
Second Line contains Triple for angle
Third Line contains Triple for Angle
If the input is +,
you need to output the Prime Triple Corresponding to angle A+B.
If the input is -,
you need to output the Prime Triple Corresponding to angle A-B.
4 3 5
15 8 17
4 3 5
3 4 5
3 4 5
3 4 5
-1 0 1
0 1 1
36 77 85
24 -7 25
-7 24 25
0 -1 1
|Time Limit:||0.291667 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.