Skip to main content
Back to problems
Codeforces
Easy
Geometry
Math
Triangle

Determine whether three side lengths can form a triangle, and if so, classify the triangle by its side equality.

Acceptance 0%
Problem Statement

Problem

You are given three positive integers representing the lengths of three segments.

Determine whether these segments can form a non-degenerate triangle. If they can, classify the triangle as:

  • Equilateral: all three sides are equal
  • Isosceles: exactly two sides are equal
  • Scalene: all sides are different

If the segments cannot form a triangle, report that it is Impossible.

A triangle is valid only if the sum of any two side lengths is strictly greater than the third side.

Input Format

  • One line containing three integers aa, bb, and cc.
  • The three values represent the lengths of the segments.

Output Format

Print one of the following:

  • Equilateral
  • Isosceles
  • Scalene
  • Impossible

Constraints

  • 1a,b,c1 \le a, b, c
  • Use the strict triangle inequality: each pair of sides must sum to more than the third side.
Examples
Sample cases returned by the problem API.

Example 1

Input

3 4 5

Output

Scalene

Explanation

The sides satisfy the triangle inequality, and all three lengths are different.

Example 2

Input

2 2 3

Output

Isosceles

Explanation

The three sides can form a triangle, and exactly two sides are equal.

Show 1 more example

Example 3

Input

1 2 3

Output

Impossible

Explanation

The sum of the two smaller sides is not greater than the largest side.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.