309379: CF1670D. Very Suspicious

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Very Suspicious

题意翻译

有一个**无穷大**的平面蜂巢,它由无数个正六边形拼接形成。 你可以在这个平面蜂巢画直线,满足这条直线平行于某个正六边形的某条边。直线和六边形的边能够围成正三角形。 每个正三角形内部不能有其它的直线和边存在 问: 构造**至少** $n$ 个正三角形至少需要多少条直线

题目描述

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? ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1670D/5491a1c977b08c3202f038f487f2a32d813abedc.png)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

说明

In the first and second test cases only 2 lines are needed. After adding the first line, no equilateral triangles will be created no matter where it is added. But after adding the second line, two more triangles will be created at once. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1670D/22d6faf1616d600d29aaaff5a040ccd6f3af5678.png)In the third test case, the minimum needed is 3 lines as shown below. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1670D/2b991947c4bc515f58f281666fad74ef0d33ed67.png)

Input

题意翻译

有一个**无穷大**的平面蜂巢,它由无数个正六边形拼接形成。 你可以在这个平面蜂巢画直线,满足这条直线平行于某个正六边形的某条边。直线和六边形的边能够围成正三角形。 每个正三角形内部不能有其它的直线和边存在 问: 构造**至少** $n$ 个正三角形至少需要多少条直线

加入题单

算法标签: