TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

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.

  • 1 <= T <= 51401
  • 1 <= K <= 1012

Output Format

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

Sample Input 1

2
10
17

Sample Output 1

4
7

Hints

Problem Source

Migrated from old NTUJ.

hacker rank

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 65536 131072