#P5717. 【深基3.习8】三角形分类

【深基3.习8】三角形分类

Triangle Classification

Problem Background

Luogu P5717

Problem Description

Given the lengths a,b,ca,b,c of three line segments, all positive integers not exceeding 1000010000. You want to assemble these three segments into a triangle. What kind of triangle can it be?

  • If the three segments cannot form a triangle, output Not triangle;
  • If it is a right triangle, output Right triangle;
  • If it is an acute triangle, output Acute triangle;
  • If it is an obtuse triangle, output Obtuse triangle;
  • If it is an isosceles triangle, output Isosceles triangle;
  • If it is an equilateral triangle, output Equilateral triangle.

If the triangle satisfies several of the above conditions at once, output them in the order listed above, each on its own line, separated by newline characters.

Input Format

Input three integers aa, bb and cc.

Output Format

Output several lines, each a classification string.

Sample Input 1

3 3 3

Sample Output 1

Acute triangle
Isosceles triangle
Equilateral triangle

Sample Input 2

3 4 5

Sample Output 2

Right triangle

Sample Input 3

6 10 6

Sample Output 3

Obtuse triangle
Isosceles triangle

Sample Input 4

1 14 5

Sample Output 4

Not triangle

Hint

  • Proceed in two steps: first decide whether a triangle can be formed (check every pair of sides), then classify it if it can.
  • For right / acute / obtuse, compare the sum of the squares of the two shorter sides with the square of the longest side; for isosceles / equilateral, compare the side lengths for equality.
  • Pay attention to the number of output lines: output exactly as many lines as conditions are satisfied — re-read the statement to confirm.

When the sum of the squares of the two shorter sides is greater than the square of the longest side, the triangle is acute.

When they are equal, it is a right triangle.

When the sum is less than the square of the longest side, it is an obtuse triangle.