QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#8960. 旧的解决方法

Statistiques

平面上有 6 个不同的点 $A, B, C, D, E, F$。点 $A, B, C$ 不共线。

Svetozar 画了一条经过点 $A$ 和 $D$ 的直线 $a$,一条经过点 $B$ 和 $E$ 的直线 $b$,以及一条经过点 $C$ 和 $F$ 的直线 $c$。已知这三条直线互不平行。现在他想要将直线 $a$ 绕点 $A$、直线 $b$ 绕点 $B$、直线 $c$ 绕点 $C$ 逆时针旋转相同的角度,然后求出旋转后三条直线的交点,并以这三个交点为顶点画一个三角形(如果它们不共线的话)。

Svetozar 想要得到面积尽可能大的三角形。如果无法构成三角形,Svetozar 认为面积为 0。求这个最大面积。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 10^5$),表示测试用例的数量。

接下来是 $T$ 个测试用例的描述。每个描述包含 6 行,分别描述点 $A, B, C, D, E, F$。每个点的描述包含两个整数 $x$ 和 $y$ ($-20 \le x, y \le 20$),表示点的坐标。

保证在每个测试用例中,所有点互不相同,点 $A, B, C$ 不共线,且直线 $AD, BE, CF$ 两两不平行。

输出格式

对于每个测试用例,输出一个实数,表示三角形的最大可能面积。要求绝对误差或相对误差不超过 $10^{-6}$。保证在所有测试中,该面积不超过 $10^7$。

样例

样例输入 1

1
1 1
4 1
4 5
1 2
5 1
5 6

样例输出 1

8.500000000

说明

在样例中,通过将直线旋转约 $104.036^\circ$ 可以达到最大面积。面积最大的三角形边长分别为 $\sqrt{17}, \sqrt{17}, \sqrt{34}$,顶点位于 $(a, b), (a-1, b+4)$ 和 $(a+4, b+1)$,其中 $a \approx 3.8235, b \approx 1.7059$。

在下方的插图中,原始直线用虚线标记,旋转后的直线用实线标记:

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.