QOJ.ac

QOJ

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

#3333. 焦土政策

الإحصائيات

为了修复一些错误和困难,本题在比赛后进行了轻微简化。原题中 $0 \le d \le 180$ 且没有 $x_u < x_o$ 的限制。

Arne Heisveis 将军是挪威国防经费不断削减的受害者。由于几乎没有资金可用,Arne 被迫在沉闷的办公室里虚度光阴。

为了避免因无聊而导致毫无意义的死亡,Arne 的一位同事找到了一款名为《焦土》(Scorched Earth)的老式电脑游戏,将军们现在整天都在玩这个游戏。问题在于 Arne 在这个游戏中并不擅长,但他依然非常好胜。因此,他希望你编写一个程序来帮他作弊。

上图展示了《焦土》的游戏截图。将军们的比赛将是一系列两人之间的战斗,唯一允许使用的武器是小型导弹。每位玩家控制一辆坦克,目标是通过射击摧毁对手的坦克。玩家轮流射击,并控制导弹的角度和初速度。初速度不能超过 $300.0\text{ m/s}$,当然也不能为负数。

为了使炮弹击中目标,它必须避开战场上的所有山脉,并以正确的速度和角度击中对手。重力加速度始终为 $9.8\text{ m/s}^2$,并且可能存在风。为了简化问题,我们假设风给炮弹提供了恒定的加速度。

Arne 对找到一个能避开战场上所有山脉的角度非常有信心,但他需要你的帮助来调整射击的初速度。

输入格式

输入包含 $n \le 1000$ 组测试用例,其中 $n$ 由输入的第一行给出。每个测试用例由一行包含 6 个浮点数的行描述:$x_u, y_u, x_o, y_o, w, d$。你的坦克位于 $(x_u, y_u)$(单位:米),对手位于 $(x_o, y_o)$,其中 $0.0 \le x_u < x_o \le 1000.0$ 且 $0.0 \le y_u, y_o \le 800.0$。数值 $-2.0 \le w \le 2.0$ 表示风引起的炮弹在 $x$ 轴方向上的加速度(单位:$\text{m/s}^2$)。Arne 选择的角度 $d$ 由 $0 < d < 78$(单位:度)给出。角度 $d = 0$ 表示沿 $x$ 轴正方向射击,$d = 90$ 本应表示沿 $y$ 轴正方向射击。

输出格式

对于每个测试用例,输出一行包含确保击中目标的初速度,保留 5 位小数。如果无法击中,则输出一行文本 “impossible”。

样例

输入 1

2
0.0 0.0 500.0 0.0 0.0 45.0
100.0 0.0 500.0 0.0 0.0 135.0

输出 1

70.00000
impossible

Figure 1. 《焦土》的游戏截图

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.