#P16262. [蓝桥杯 2026 省 Python B 组] 定制展示盘

    ID: 18282 远端评测题 3000ms 512MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>数论素数判断,质数,筛法2026蓝桥杯省赛

[蓝桥杯 2026 省 Python B 组] 定制展示盘

Problem 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 22.

Xiao Lan has a total of nn 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 nn.

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 TT, representing the number of test cases.

The next TT lines each contain a positive integer nn, representing the total number of commemorative coins Xiao Lan has.

Output Format

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

2
3
5
4
6

Hint

Sample Explanation

When n=3n = 3, one optimal plan is to customize a 2×22 \times 2 display tray, and the total number of slots is 44.
When n=5n = 5, one optimal plan is to customize a 2×32 \times 3 display tray, and the total number of slots is 66.

Constraints

For 20%20\% of the test cases: 1≤T≤101 \leq T \leq 10, 1≤n≤1031 \leq n \leq 10^3.
For all test cases: 1≤T≤1001 \leq T \leq 100, 1≤n≤1091 \leq n \leq 10^9.

Translated by ChatGPT 5