其他分享
首页 > 其他分享> > 2022.02.05翻译Triangle

2022.02.05翻译Triangle

作者:互联网

Triangle
题目(https://acs.jxnu.edu.cn/problem/CF6A)描述:
Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of different colours. Naturally, one of the sticks is extra. It is not allowed to break the sticks or use their partial length. Anne has perfectly solved this task, now she is asking Johnny to do the same.

The boy answered that he would cope with it without any difficulty. However, after a while he found out that different tricky things can occur. It can happen that it is impossible to construct a triangle of a positive area, but it is possible to construct a degenerate triangle. It can be so, that it is impossible to construct a degenerate triangle even. As Johnny is very lazy, he does not want to consider such a big amount of cases, he asks you to help him.

输入:
The first line of the input contains four space-separated positive integer numbers not exceeding 100 — lengthes of the sticks.

输出:
Output TRIANGLE if it is possible to construct a non-degenerate triangle. Output SEGMENT if the first case cannot take place and it is possible to construct a degenerate triangle. Output IMPOSSIBLE if it is impossible to construct any triangle. Remember that you are to use three sticks. It is not allowed to break the sticks or use their partial length.

样例输入:
4 2 1 3
样例输出:
TRIANGLE
样例输入:
7 2 2 4
样例输出:
SEGMENT
样例输入:
3 5 9 1
样例输出:
IMPOSSIBLE

翻译:
Johnny有一个妹妹Anne,非常聪明。当她从幼儿园回来时,她告诉哥哥幼儿园交给她去解决的任务。这个任务仅仅是从四根不同颜色的棍子中选出三根组成一个三角形。自然有一根多余的棍子。不允许弄断棍子或者只使用棍子的一部分。Anne已经完美的完成了这个任务,现在她叫哥哥做同样的事。

哥哥说他将会毫无问题的完成这个任务。然而,过了一会儿他发现另一个棘手的问题。可能发生构造不出一个正面积的三角形,但可能构造出一个退化的三角形。也可能构造不出一个退化三角形。因为哥哥很懒,她不想考虑如此多的情况,他请你帮他。

输入:
第一行包含四个由单空额隔开的四个整数(不超过100)表示棍子的长度。

输出:
输出TRIANGLE如果可以构造出一个不退化的三角形。输出SEGMENT如果发生第一种情况并且可能构造出一个退化三角形。输出IMPOSSIBLE如果构造不出三角形。注意 ,你不能弄断棍子或只使用棍子的一部分。


样例输入:
4 2 1 3
样例输出:
TRIANGLE
样例输入:
7 2 2 4
样例输出:
SEGMENT
样例输入:
3 5 9 1
样例输出:
IMPOSSIBLE

标签:输出,triangle,sticks,05,样例,construct,棍子,Triangle,2022.02
来源: https://blog.csdn.net/qq_61838643/article/details/122793459