-->
当前位置:首页 > 题库

PROGRAMMING:Judge whether a triangle can be formed and its shape.

Luz5年前 (2021-05-10)题库486
Please program to input 3 integers from the keyboard to judge whether these 3 integers can form a triangle (condition: three sides are greater than 0 and the sum of any two sides is greater than the third side). If so, further judge whether it is equilateral, isosceles or general triangle, otherwise output "- 1" information.
###Input format:
Three positive integers separated by spaces.
###Output format:
If it is an equilateral triangle, output "1", if it is an isosceles triangle, output "2", if it is an ordinary triangle, output "3", if it cannot form a triangle, output "- 1".
###Input example:
```in
1 2 3
```
###Output example:
```out
-1
```







answer:If there is no answer, please comment