#B2149. Triangle Validator and Area Calculator
Triangle Validator and Area Calculator
Triangle Validator and Area Calculator
Given three line segment lengths a
, b
, and c
, determine whether they can form a triangle. A triangle can be formed if and only if the following conditions hold:
\( a + b > c, \quad a + c > b, \quad b + c > a \)
If the segments can form a triangle, compute its area using Heron's formula:
\( s = \frac{a+b+c}{2} \quad \text{and} \quad \text{Area} = \sqrt{s(s-a)(s-b)(s-c)} \)
If they cannot form a triangle, output No solution.
(note the period at the end).
inputFormat
The input consists of a single line containing three numbers a
, b
, and c
separated by spaces.
outputFormat
If the input lengths can form a triangle, output its area computed by Heron's formula. Otherwise, output No solution.
sample
3 4 5
6.0