#C8276. Triangle Area Calculation
Triangle Area Calculation
Triangle Area Calculation
Given three integers representing the sides of a triangle, determine whether they can form a valid triangle. If they can, compute the area of the triangle using Heron's formula. Otherwise, output -1.
Heron's formula is given by:
[
A = \sqrt{s (s-A)(s-B)(s-C)}]
where (s = \frac{A+B+C}{2}) is the semi-perimeter of the triangle.
inputFormat
The input consists of a single line containing three space-separated integers, (A), (B), and (C), representing the lengths of the sides of a triangle.
outputFormat
Output the area of the triangle as a floating-point number if the three sides can form a valid triangle using the triangle inequality; otherwise, output -1.## sample
3 4 5
6