QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 2048 MB 満点: 100

#2310. 一道简单的几何题

統計

旋转在计算几何中起着重要作用。在本题中,我们关注以下二维旋转问题:

给定一个二维点 $(x, y)$,求其逆时针旋转角度 $\theta$ 后的位置。

如果你已经从线性代数等课程中掌握了该问题的解法,那再好不过了。否则,我们将按如下方式推导解法。

我最喜欢的推导方式是基于复数。复数是可以表示为 $a + bi$ 形式的数,其中 $a$ 和 $b$ 是实数,$i$ 是方程 $z^2 = -1$ 的解,被称为虚数,因为没有实数满足该方程。旋转实际上等价于 $(x+yi) \cdot (\cos \theta + \sin \theta i) = (x \cos \theta - y \sin \theta) + (x \sin \theta + y \cos \theta)i$。因此,新的 $x$ 坐标为 $x \cos \theta - y \sin \theta$,新的 $y$ 坐标为 $x \sin \theta + y \cos \theta$。现在,你应该能够使用内置的数学函数来解决这个问题了 :)。祝你玩得开心!

输入格式

输入的第一行包含一个正整数 $T$ ($1 \le T \le 100$),表示测试用例的总数。接下来的 $T$ 行中,每一行包含三个浮点数 $x$、$y$ 和 $\theta$ ($0 \le |x|, |y| \le 100, 0 \le \theta \le 360$),如前所述。$\theta$ 的单位为度。所有浮点数的小数点后均恰好有 2 位数字。

输出格式

对于每个测试用例,输出一行旋转后的位置。所有浮点数均需四舍五入保留小数点后 2 位。

样例

输入 1

3
1 0 0.00
2 0 90.00
2 1 30.00

输出 1

1.00 0.00
0.00 2.00
1.23 1.87

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.