最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1809B - Points on Plane

2023-07-20 16:14 作者:您是打尖兒還是住店呢  | 我要投稿

You are given a two-dimensional plane, and you need to place n chips on it.

You can place a chip only at a point with integer coordinates. The cost of placing a chip at the point (x,y) is equal to |x|+|y| (where |a|

?is the absolute value of a).

The cost of placing n chips is equal to the maximum among the costs of each chip.

You need to place n chips on the plane in such a way that the Euclidean distance between each pair of chips is strictly greater than1, and the cost is the minimum possible.

Input

The first line contains one integer t (1≤t≤104) — the number of test cases. Next t cases follow.

The first and only line of each test case contains one integer n

?(1≤n≤1018) — the number of chips you need to place.


Output

For each test case, print a single integer — the minimum cost to place n chips if the distance between each pair of chips must be strictly greater than 1.

-------------------------------------

給你一個二維平面,你需要在上面放置 n 個芯片。

您只能將芯片放置在具有整數(shù)坐標的點上。 將籌碼放置在點 (x,y) 的成本等于 |x|+|y| (其中 |a|

? 是 a) 的絕對值。

放置n個芯片的成本等于每個芯片成本中的最大值。

你需要將n個芯片放置在平面上,使得每對芯片之間的歐氏距離嚴格大于1,并且成本盡可能最小。

輸入

第一行包含一個整數(shù) t (1≤t≤104) — 測試用例的數(shù)量。 接下來是t個案例。

每個測試用例的第一行也是唯一一行包含一個整數(shù) n

? (1≤n≤1018) — 您需要放置的芯片數(shù)量。


輸出

對于每個測試用例,打印一個整數(shù) - 如果每對芯片之間的距離必須嚴格大于 1,則放置 n 個芯片的最小成本。

------------------------------

我們舉個例子;

如果是5-9個就需要2個。

如果是10-16個就需要4個。

如果是n個,那么就看n的平方根正好是整數(shù)不是,如果是,--,如果不是,+1,然后輸出這個數(shù)-1的數(shù)。

有點繞啊。。我是越來越看不懂了。


CF 1809B - Points on Plane的評論 (共 條)

分享到微博請遵守國家法律
富民县| 华阴市| 辰溪县| 甘南县| 山阴县| 百色市| 轮台县| 镇原县| 普定县| 固始县| 金堂县| 登封市| 靖西县| 嘉义市| 大足县| 石城县| 衡水市| 礼泉县| 饶阳县| 郓城县| 威海市| 邹平县| 奉新县| 台北市| 宝丰县| 高唐县| 永州市| 舞阳县| 嘉祥县| 轮台县| 台安县| 兴义市| 饶阳县| 朔州市| 方正县| 如东县| 张家界市| 罗山县| 茌平县| 资溪县| 旺苍县|