QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 22

#5779. 缩放三角形

الإحصائيات

给定两张三角形形状的图片。第二张图片是第一张图片经过平移、旋转和缩放后的版本。这两个三角形放置在桌面上,其中第二个三角形完全位于第一个三角形内部(可能接触边界)。第二个三角形的缩放比例严格介于 0 和 1 之间。

你需要处理这张图片,为此你需要找到图片中的一个点,该点与缩放后图片中的对应点重合。如果存在多个解,你可以返回其中任意一个。如果不存在解,请针对该测试用例输出 "No Solution"(不含引号)。

输入格式

输入的第一行包含测试用例的数量 $N$。对于每个测试用例,包含两行,每行包含六个以空格分隔的整数,表示其中一个三角形的坐标,格式为 "$x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$"。第一个三角形中的点 $(x_1, y_1)$ 对应于第二个三角形中图片相同顶点的 $(x_1, y_1)$,$(x_2, y_2)$ 和 $(x_3, y_3)$ 同理。

输出格式

对于每个测试用例,输出一行,格式为 "Case #$x$: ",后跟两个以空格分隔的实数,表示重合点的坐标,或者输出字符串 "No Solution"。相对误差或绝对误差不超过 $10^{-5}$ 的答案将被视为正确。

数据范围

$1 \le N \le 10$。

点的坐标为 $-10\,000$ 到 $10\,000$ 之间的整数。每个三角形的三个点不共线。

小数据集(测试集 1 - 可见;9 分)

所有测试用例均包含等腰直角三角形(即三角形的角分别为 45 度、45 度和 90 度)。

大数据集(测试集 2 - 隐藏;13 分)

三角形可以是任意形状。

样例

输入格式 1

2
0 0 0 2 2 0
0 0 0 1 1 0
10 0 0 10 0 0
3 3 1 1 3 1

输出格式 1

Case #1: 0.000000 0.000000
Case #2: 2.692308 1.538462

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.