题库练习 Very Suspicious
← 上一题 下一题 →

A15011 | Very Suspicious

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Sehr Sus is an infinite hexagonal grid as pictured below, controlled by MennaFadali, ZerooCool and Hosssam.

They love equilateral triangles and want to create $n$ equilateral triangles on the grid by adding some straight lines. The triangles must all be empty from the inside (in other words, no straight line or hexagon edge should pass through any of the triangles).

You are allowed to add straight lines parallel to the edges of the hexagons. Given $n$ , what is the minimum number of lines you need to add to create at least $n$ equilateral triangles as described?

![](/uploads/acgo/image/ec68c81039fa7729_52c9dadcbcd0.jpeg)Adding two red lines results in two new yellow equilateral triangles.

输入格式

The first line contains a single integer $t$ ( $1 \le t \le 10^5$ ) — the number of test cases. Then $t$ test cases follow.

Each test case contains a single integer $n$ ( $1 \le n \le 10^{9}$ ) — the required number of equilateral triangles.

输出格式

For each test case, print the minimum number of lines needed to have $n$ or more equilateral triangles.

输入输出样例

输入 #1
4
1
2
3
4567
输出 #1
2
2
3
83
C++ 编辑器
输入
输出