QOJ.ac

QOJ

実行時間制限: 2.0 s メモリ制限: 512 MB 満点: 100 ハック可能 ✓

#12328. 向西进发

統計

最近,Byteland 政府签署了一项名为“向西进发”(Go West)的法案。根据该法案,每一位 Byteland 公民都可以免费在远西地区获得一块土地!

土地授予的程序如下:你将获得一根长度为 $K$ 毫米的木棍和一根长度为 $L$ 毫米的绳子。木棍是不可弯曲的,而绳子可以以任何方式弯曲。接下来,你将木棍和绳子放置在地面上,并测量由木棍和绳子围成的区域的面积 $S$。政府随后会为你分配一块面积为 $S$ 平方毫米的土地。

形式化地讲,你拥有一个长度为 $K$ 的线段和一个长度为 $L$ 的连通曲线。将该线段和曲线放置在平面上。它们将平面分割成若干区域。选取其中任意一个有限区域并计算其面积 $S$。曲线可以具有任何可行的形状,而线段必须保持完整。如有必要,这些图形可以在平面上旋转。你不能改变图形的长度,也不能将它们切割成若干部分。

显然,你希望获得的远西土地面积尽可能大。给定 $K$ 和 $L$,求出你能获得的最大面积 $S$。

输入格式

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

接下来 $T$ 行,每行包含两个整数 $K_i$ 和 $L_i$ ($1 \le K_i \le 10^5, 1 \le L_i \le 10^5$),分别表示木棍和绳子的长度。

输出格式

对于第 $i$ 个测试用例,输出一行,包含一个实数 $S_i$。如果你的答案与标准答案的绝对误差或相对误差不超过 $10^{-9}$,则被视为正确。

样例

输入 1

3
14 15
92 65
358 979

输出 1

35.809862195676
672.429634563258
132235.233920283205

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.