QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100

#12355. Aloha

Statistics

Chiaki 生活在一个能量守恒定律完全不同的特殊宇宙中。具体来说,该定律由方程 $v^2 + 2gy = 0$ 描述,其中 $v$ 是物体在点 $(x, y)$ 处的速度,$g$ 是重力加速度,等于 $10$。

起初,Chiaki 位于原点 $(0, 0)$,没有任何动能,她想利用一些管道前往点 $(x, y)$。在整个旅程中,能量守恒定律始终适用于她。

Chiaki 有三根长度分别为 $l_1, l_2$ 和 $l_3$ 的直管。她必须使用这些管道建造一条隧道,作为前往目的地的路线。

  • 至少使用一根管道,每根管道只能使用一次,且管道不能弯曲或切割。
  • 隧道必须从 $(0, 0)$ 开始,并在目的地 $(x, y)$ 结束。
  • 管道必须首尾相连。

Chiaki 想知道是否可以到达目的地,如果可以,求出到达目的地的最短时间。

输入格式

输入包含多组测试数据。第一行包含一个整数 $T$ ($1 \le T \le 500$),表示测试数据的组数。对于每组测试数据:

第一行包含五个整数 $x, y, l_1, l_2$ 和 $l_3$ ($-1000 \le x, y \le 1000, 1 \le l_1, l_2, l_3 \le 1000$),分别表示目的地的坐标和每根管道的长度。

输出格式

对于每组测试数据,输出一行,包含一个实数,表示最短时间;如果 Chiaki 无法到达目的地,则输出字符串 “Impossible!”(不含引号)。

如果你的答案的绝对误差或相对误差小于 $10^{-8}$,则被视为正确。

样例

输入 1

4
0 1 1 1 1
3 -4 2 3 3
-1000 0 499 499 3
0 -8 10 2 1000

输出 1

Impossible!
1.118033988749895
90.005448343698845
1.563516060678838

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.