UVa 10347 - Medians 发表于 2016-08-17 分类于 AOAPC Training Guide , Chapter 4. Geometry , Basic Problems Disqus: 链接传送门题意给出三条边作为三角形的中线,求三角形的面积,不合法输出“-1.000”。思路三角形的中线可以组成三角形,其面积是原三角形面积的\(\frac{3}{4}\)。代码12345678910111213141516171819#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int main() { double a, b, c; while (~scanf("%lf%lf%lf", &a, &b, &c)) { if (a + b <= c || a + c <= b || b + c <= a) { puts("-1.000"); } else { double p = (a + b + c) / 2; printf("%.3f\n", sqrt(p * (p - a) * (p - b) * (p - c)) * 4 / 3); } } return 0;}相关文章Training:计算几何基础UVa 10439 - Temple of DuneUVa 10522 - Height to AreaUVa 10566 - Crossed LaddersUVa 11646 - Athletics Track(几何)