CF6A.Triangle

入门

通过率:0%

时间限制:2.00s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

输入的第一行包含四个用空格分隔的正整数,均不超过 100 —— 分别表示四根木棍的长度。

输出格式

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.

如果可以构成一个非退化三角形,则输出 TRIANGLE;如果无法构成非退化三角形,但可以构成一个退化三角形,则输出 SEGMENT;如果完全无法构成任何三角形,则输出 IMPOSSIBLE。注意:你必须恰好使用三根木棍,不允许折断木棍或仅使用其部分长度。

输入输出样例

  • 输入#1

    4 2 1 3

    输出#1

    TRIANGLE
  • 输入#2

    7 2 2 4

    输出#2

    SEGMENT
  • 输入#3

    3 5 9 1

    输出#3

    IMPOSSIBLE

输入解题思路,AI测评打分。不知道怎么写?

首页