Statistics

Problem Statement for "TriangleType"

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 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:
TriangleType
Method:
type
Parameters:
int, int, int
Returns:
String
Method signature:
String type(int a, int b, int c)
(be sure your method is public)

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.

Constraints

  • a, b, and c are between 1 and 10,000, inclusive.

Examples

  1. 3

    4

    5

    Returns: "RIGHT"

  2. 3

    4

    4

    Returns: "ACUTE"

  3. 3

    4

    6

    Returns: "OBTUSE"

  4. 7

    4

    3

    Returns: "IMPOSSIBLE"

  5. 17

    13

    11

    Returns: "ACUTE"

  6. 15

    8

    17

    Returns: "RIGHT"

  7. 6000

    8000

    10000

    Returns: "RIGHT"

  8. 5000

    5000

    10000

    Returns: "IMPOSSIBLE"

  9. 5001

    5000

    10000

    Returns: "OBTUSE"

  10. 10000

    1

    1

    Returns: "IMPOSSIBLE"

  11. 1

    4

    7

    Returns: "IMPOSSIBLE"

  12. 3

    3

    10

    Returns: "IMPOSSIBLE"

  13. 3

    4

    5

    Returns: "RIGHT"

  14. 5

    4

    3

    Returns: "RIGHT"

  15. 7

    5

    6

    Returns: "ACUTE"

  16. 7

    4

    3

    Returns: "IMPOSSIBLE"

  17. 6

    4

    3

    Returns: "OBTUSE"

  18. 4

    3

    2

    Returns: "OBTUSE"

  19. 3

    3

    6

    Returns: "IMPOSSIBLE"

  20. 3

    2

    1

    Returns: "IMPOSSIBLE"

  21. 10

    8

    6

    Returns: "RIGHT"

  22. 100

    1

    1

    Returns: "IMPOSSIBLE"

  23. 3

    5

    4

    Returns: "RIGHT"

  24. 3

    5

    15

    Returns: "IMPOSSIBLE"

  25. 1

    10

    2

    Returns: "IMPOSSIBLE"

  26. 3

    4

    4

    Returns: "ACUTE"

  27. 3

    2

    4

    Returns: "OBTUSE"

  28. 3

    5

    3

    Returns: "OBTUSE"

  29. 1

    2

    3

    Returns: "IMPOSSIBLE"

  30. 9

    5

    2

    Returns: "IMPOSSIBLE"

  31. 3

    6

    4

    Returns: "OBTUSE"

  32. 4

    5

    3

    Returns: "RIGHT"

  33. 6

    4

    5

    Returns: "ACUTE"


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: