CF 1809B - Points on Plane
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 个芯片。
您只能将芯片放置在具有整数坐标的点上。 将筹码放置在点 (x,y) 的成本等于 |x|+|y| (其中 |a|
是 a) 的绝对值。
放置n个芯片的成本等于每个芯片成本中的最大值。
你需要将n个芯片放置在平面上,使得每对芯片之间的欧氏距离严格大于1,并且成本尽可能最小。
输入
第一行包含一个整数 t (1≤t≤104) — 测试用例的数量。 接下来是t个案例。
每个测试用例的第一行也是唯一一行包含一个整数 n
(1≤n≤1018) — 您需要放置的芯片数量。
输出
对于每个测试用例,打印一个整数 - 如果每对芯片之间的距离必须严格大于 1,则放置 n 个芯片的最小成本。
------------------------------
我们举个例子;
如果是5-9个就需要2个。
如果是10-16个就需要4个。
如果是n个,那么就看n的平方根正好是整数不是,如果是,--,如果不是,+1,然后输出这个数-1的数。
有点绕啊。。我是越来越看不懂了。