[Solution] The Ultimate Square Codeforces Solution
You have rectangular wooden blocks, which are numbered from to . The -th block is unit high and units long.
Here, denotes the result of division of by , rounded up. For example, and .
For example, if , then the blocks have the following sizes: , , , , .
Find the maximum possible side length of a square you can create using these blocks, without rotating any of them. Note that you don't have to use all of the blocks.
Each test contains multiple test cases. The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the number of blocks.
For each test case, print one integer — the maximum possible side length of a square you can create.
In the first test case, you can create a square using only one of the blocks.
In the second test case, one of the possible ways to create a square is shown in the statement. It is impossible to create a or larger square, so the answer is .
No comments:
Post a Comment