Suppose a triangle has side lengths $a, b$ and $c$. Find its area.
The question could have ended here, but since I am a very kind problemsetter, here is some additional information:
Heron's formula gives the area of the triangle $A$, in terms of $a$, $b$ and $c$, as $$A = \sqrt{s(s - a)(s - b)(s - c)}$$ where $s$ is the semiperimeter of the triangle, i.e. the perimeter of the triangle divided by $2$.
Input
The only line of input consists of three integers $a, b$ and $c$. $(1 \le a, b, c \le 100)$
Output
Output the area of the triangle. Your answer will be accepted if the difference
between your answer and the actual answer is at most $10^{-4}$.
If you are using C++, using fixed
and setprecision
from <iomanip>
is recommended.
Sample Test Cases
Input | Output | |
---|---|---|
3 4 5 | 6.0 | |
7 8 9 | 26.8328157 | |
There are other correct outputs. You can output as many decimal places as necessary, as long as the absolute error is at most $10^{-4}$. |
Scoring: Per Subtask
Authored by s16f22
Appeared in 2023 Children's Day Mini Contest