Statistics

Problem Statement for "Cosines"

Problem Statement

PROBLEM STATEMENT

In Euclidean Geometry, triangles can be categorized into one of three types
based on their angle measures.  A triangle is acute if all three angles are
less than 90 degrees.  A triangle is obtuse if one angle is greater than 90
degrees.  Lastly, a triangle with one angle at exactly 90 degrees is a right
triangle.

It could also be the case that three positive integers can not possibly form
the side-lengths of a triangle. This happens when the length of one side is
equal to or larger than the sum of the lengths of the other two sides, because
it would not be possible to connect the end points of the three sides in such a
way that a triangle was formed.

Write a method calcType that takes as input three positive integer side-lengths
of a triangle. Return "IMPOSSIBLE" if a triangle cannot be formed.  Return
"ACUTE" if the triangle is acute, "OBTUSE" if the triangle is obtuse, and
"RIGHT" if the triangle is right.

DEFINITION
Class: Cosines
Method: calcType
Parameters: int, int, int
Returns: String
The method signature is (make sure it is declared public): String calcType(int
a, int b, int c);

NOTES
*For a triangle with side-lengths x, y, and z and x <= y <= z. 
  The triangle is right if x*x + y*y = z*z.
  The triangle is obtuse if x*x + y*y < z*z.
  The triangle is acute if x*x + y*y > z*z.
  It is impossible to have x + y <= z.

TopCoder will ensure the validity of the inputs.  Inputs are valid if all of
the following criteria are met:
* a, b, and c are between 1 and 10,000 inclusive

EXAMPLES

Example 1
a = 3
b = 4
c = 5
returns "RIGHT"

Example 2
a = 3
b = 4
c = 4
returns "ACUTE"

Example 3
a = 3
b = 4
c = 6
returns "OBTUSE"

Example 4
a = 7
b = 4
c = 3
returns "IMPOSSIBLE"

Definition

Class:
Cosines
Method:
calcType
Parameters:
int, int, int
Returns:
String
Method signature:
String calcType(int param0, int param1, int param2)
(be sure your method is public)

Constraints

    Examples


      This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: