library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub satanic0258/library

:warning: ヘロンの公式
(math/heron.hpp)

概要

三角形の辺の長さがそれぞれ $a$, $b$, $c$ であったとき,
$s=\frac{a+b+c}{2}$ とおくと,面積 $S$ は
$S = \sqrt{s(s-a)(s-b)(s-c)}$ である.

Code

// @brief ヘロンの公式
// @shortcut heron
// @description ヘロンの公式を用いて三角形の面積を計算する.O(1).
// @docs math/heron.md
double Heron(double a, double b, double c) {
 double s = (a + b + c) / 2;
 return std::sqrt(s*(s - a)*(s - b)*(s - c));
}
#line 1 "math/heron.hpp"
// @brief ヘロンの公式
// @shortcut heron
// @description ヘロンの公式を用いて三角形の面積を計算する.O(1).
// @docs math/heron.md
double Heron(double a, double b, double c) {
 double s = (a + b + c) / 2;
 return std::sqrt(s*(s - a)*(s - b)*(s - c));
}
Back to top page