TheForces Round #16 (2^4-Forces) |
---|
Finished |
There's an infinite grid graph.All cells are initially white.Your task is to dye exactly $$$n$$$ cells in red.
A blue edge is a unit edge that connects two cells with different colors.
For example,$$$n=3$$$,one of the dyeing schemes is as follows:
The number of blue edges is $$$8$$$.It can be proved that it reaches the minimum.
Find the minimum number of blue edges for given $$$n$$$.
The first line of input will contain a single integer $$$t(1 \leq t \leq 10^5)$$$, denoting the number of test cases.
Each test case consists of a line of input.The only line of each test case contains an integer $$$n(1 \leq n \leq 10^{18})$$$.
For each test case, output on a new line — the minimum number of blue edges.
4 3 5 8 50
8 10 12 30
Name |
---|