AVNRTRI - Editorial

PROBLEM LINK:

Contest

Practice

Author: Amit Kumar Pandey

Editorialist: Amit Kumar Pandey

DIFFICULTY:

SIMPLE

PREREQUISITES

Maths

PROBLEM:

Ironman wants to build his new core. For that, he inputs three random number x, y and z in Jarvis. Help Jarvis determine whether those three numbers are taken as sides form the isosceles triangle or not.

EXPLANATION:

A triangle is a 3-sided polygon.

We are given the length of three sides.

The condition for forming the triangle is the the sum of the two side of triangle must be greater than third side. If this condition satisfies then we have to find whether triangle is equilateral, isosceles or scalene triangle.

  1. If all sides of the triangle are equal then it is equilateral.

  2. If two sides are equals then the triangle is isosceles. If we find any isosceles triangle then we have to add one to counter variable because we have to print the total number of the isosceles triangle in the output.

  3. else the triangle is scalene.

If the property of triangle doesn’t get satisfied then we have to print “not triangle”.

AUTHOR’S AND EDITORIALIST’S SOLUTIONS:

Author’s solution can be found here.

Editorialist’s solution can be found here.

RELATED PROBLEMS:

AVHNTRI

1 Like