C. T 计算四边形面积

    Type: Default 1000ms 256MiB

T 计算四边形面积

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

【题目描述】

平面上有一个凸四边角形,它的四个顶点坐标分别为 (x1,y1)(x_1,y_1)(x2,y2)(x_2,y_2)(x3,y3)(x_3,y_3)(x4,y4)(x_4,y_4),那么请问这个四角形的面积是多少,精确到小数点后 22 位。

【输入】

输入仅一行,包括 88 个双精度浮点数,分别对应 x1x_1y1y_1x2x_2y2y_2x3x_3y3y_3x4x_4y4y_4

逆时针给出四边形的四个顶点。

【输出】

输出也是一行,输出四角形的面积,精确到小数点后 22 位。

【输入样例】

0 0 1 0 1 1 0 1

【输出样例】

1.00

【提示】

  • 海伦公式

三角形三边长分别为 aabbcc,令 t=12(a+b+c)t=\frac{1}{2}(a+b+c)

则三角形面积 S=t(ta)(tb)(tc)S = \sqrt{t(t-a)(t-b)(t-c)}

四边形可以看成2个三角形

初一期末考 入门组

Not Attended
Status
Done
Rule
IOI
Problem
8
Start at
2026-1-16 10:30
End at
2026-1-16 12:21
Duration
1.9 hour(s)
Host
Partic.
39