1143 : 三角形和矩形
- 时间限制Time Limit
- 1 秒Sec
- 内存限制Memory Limit
- 128 兆MB
- 提交次数Submitted
- 10 次Times
- 通过次数Solved
- 5 次Times
特判评测 Special
读写方式与标准评测相同。答案可能不唯一,是否正确由本题的特判程序判定,输出格式以题面为准。
I/O is the same as standard judge. Several outputs may be valid; this problem’s special judge decides correctness. Follow the output format in the statement.
| 输入Input | 标准输入。Standard input. |
|---|---|
| 输出Output | 标准输出,格式以题面为准。Standard output; format as specified in the statement. |
| 时间与内存Time and memory | 记选手程序的 CPU 时间和内存峰值。判定程序不计入。题目上的限制只约束选手程序。The record is the solution’s CPU time and peak memory. The checker is not included. The limits apply only to the solution. |
题目描述Description
Bobo 有一个三角形和一个矩形,他想求他们交的面积。
具体地,三角形和矩形由 8 个整数 x1,y1,x2,y2,x3,y3,x4,y4 描述,表示三角形的顶点坐标是 (x1,y1),(x1,y2),(x2,y1), 矩形的顶点坐标是 (x3,y3),(x3,y4),(x4,y4),(x4,y3).
输入格式Input
输入包含不超过 30000 组数据。
每组数据的第一行包含 4 个整数 x1,y1,x2,y2 (x1 ≠ x2, y1 ≠ y2).
第二行包含 4 个整数 x3,y3,x4,y4 (x3<x4,y3<y4).
(0 ≤ xi, yi ≤ 104)
输出格式Output
对于每组数据,输出一个实数表示交的面积。绝对误差或相对误差小于 10 − 6 即认为正确。
样例Sample
出题Author
ftiasch
来源Source
湖南省第十二届大学生计算机程序设计竞赛(HNCPC2016)
题目到此结束End of problem