P16262 [Lanqiao Cup 2026 NOI Qualifier Python Group B] Custom Display Tray

Description

Xiao Lan is designing a display tray for storing commemorative coins. Due to limitations of the manufacturing equipment, the tray must satisfy the following conditions: - The tray is a rectangle, consisting of several rows and several columns of slots. - The number of rows and the number of slots in each row are both at least $2$. Xiao Lan has a total of $n$ commemorative coins to place. He can customize trays of different sizes as needed, as long as the total number of slots on the tray (i.e., the product of the number of rows and the number of slots per row) is at least $n$. The manufacturing cost is calculated based on the total area of the tray (i.e., the total number of slots). Therefore, under the placement requirement and equipment constraints, Xiao Lan wants the total number of slots to be as small as possible. Now please help him compute this minimum value.

Input Format

The first line contains a positive integer $T$, representing the number of test cases. The next $T$ lines each contain a positive integer $n$, representing the total number of commemorative coins Xiao Lan has.

Output Format

Output $T$ lines in total. Each line contains an integer, representing the minimum total number of slots required for the display tray under all constraints.

Explanation/Hint

### Sample Explanation When $n = 3$, one optimal plan is to customize a $2 \times 2$ display tray, and the total number of slots is $4$. When $n = 5$, one optimal plan is to customize a $2 \times 3$ display tray, and the total number of slots is $6$. ### Constraints For $20\%$ of the test cases: $1 \leq T \leq 10$, $1 \leq n \leq 10^3$. For all test cases: $1 \leq T \leq 100$, $1 \leq n \leq 10^9$. Translated by ChatGPT 5