#t217. 海伦公式

海伦公式

Heron's Formula

Problem Description

Given the lengths of the three sides of a triangle, compute its area.

Input Format

The input is three real numbers: the lengths of the three sides.

Output Format

Output the area of the triangle, kept to 2 decimal places.

Sample Input

3 4 5

Sample Output

6.00

Hint

  • The sides may be decimals — pick the right type.
  • Apply the formula: first compute pp, then compute SS. sqrt is in <cmath>. Keep 2 decimal places.
  • Check against the sample: 3 4 5 → 6.00.

Heron's formula: let the three sides of the triangle be  a,b,c\,a,b,c, set  p=a+b+c2\,p=\frac{a+b+c}{2}, then the area of the triangle  S=p(p−a)(p−b)(p−c)\,S=\sqrt{p(p-a)(p-b)(p-c)}.