PROBLEM LINK:
Author: Amit Kumar Pandey
Editorialist: Arkapravo Ghosh
DIFFICULTY:
CAKEWALK
PREREQUISITES:
Math
PROBLEM:
The three angles of a triangle is given. It is required to find if the triangle is right-angled, obtuse or acute triangle.
EXPLANATION:
An acute triangle is a triangle with all three angles acute (less than 90°).
An obtuse triangle is one with one obtuse angle (greater than 90°) and two acute angles.
A right-angled triangle is a triangle with one right angle(equal to 90°) and two acute angles.
Since a triangle’s angles must sum to 180°, no triangle can have more than one obtuse angle.
You just need to check the angles of the triangle and output the type of the triangle. If an angle of the triangle is equal to 90° then output “right”, if an angle is greater than 90° then output “obtuse” else output “acute”.
You can find the author’s solution and my solution below. Hope this helps.
AUTHOR’S AND EDITORIALIST’S SOLUTIONS:
Author’s solution can be found here.
Editorialist’s solution can be found here.