P14550 [HackerRank] Count palindromes
提高-
题目描述

A string is made of only lowercase latin letters (a,b,c,d,.....,z). Can you find the length of the lexicographically smallest string such that it has exactly ${K}$ sub-strings, each of which are palindromes?

Input Format

The first line of input contains single integer ${T}$ - the number of testcases.

T lines follow, each containing the integer ${K}$.

Constraints

$1\leq T\leq100$
$1\leq K\leq10^{12}$

Output Format

Output exactly ${T}$ lines. Each line should contain single integer - the length of the lexicographically smallest string.

Sample Input
2
10
17

Sample Output
4
7

Explanation

for $K=10$, one of the smallest possible strings that satisfies the property is aaaa.
All $10$ palindromes are

a,a,a,a
aa, aa, aa
aaa, aaa
aaaa

Note

Two sub-strings with different indices are both counted.

输入格式

见题面

输出格式

见题面

样例输入
2 10 17
样例输出
4 7