Programming contests

Magas szintű programozási nyelvek 1, gyakorló feladatsor, 2015. április 24.

April 24, 2015 10:00 AM – April 24, 2015 10:00 AM

Is This the Easiest Problem?

A triangle is a geometric shape with three positive sides. However, any given three sides won't necessarily form a triangle. The three sides must form a closed region. Triangles are categorized depending on the values of the sides of a valid triangle. In this problem, you are required to determine the type of a triangle.

Input Specification

The first line of the input will contain a positive integer T < 20, where T denotes the number of test cases. Each of the next T lines will contain three 32-bit signed integers.

Output Specification

For each case of input, there will be one line of output. It will be formatted as follows:

Case x: triangle type

Here, x denotes the number of the test case being processed, and triangle type is the type of the triangle, which will be one of the following, depending on the values of the three sides:

  • Invalid: The three sides cannot form a triangle.
  • Equilateral: All three sides of a valid triangle are equal.
  • Isosceles: Exactly two of the sides of a valid triangle are equal.
  • Scalene: No pair of sides are equal in a valid triangle.

Sample Input

  1. 4
  2. 1 2 5
  3. 1 1 1
  4. 4 4 2
  5. 3 4 5
download as text file

Output for Sample Input

  1. Case 1: Invalid
  2. Case 2: Equilateral
  3. Case 3: Isosceles
  4. Case 4: Scalene
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019