DCEPC202  Unique Paths
Vaibhav sir and Jyoti ma’am are pretty pissed off after taking the doubt clearing session for first batch. People are not taking them seriously and doing their assignments, so they decided only intelligent students should appear in the tutorials. So they put up a condition, only those students who came to the class walking on unique paths can attend the class. By unique path they meant that at least 1 move differs from any other path. You are at the position (0,0) in the corridor and the class is at the position (n1,4). Where n is the length of corridor and width is 5 units. You can move only to the adjacent tile on the floor. As you are not idiots you have to reach at the class using shortest path only. Corridor has some broken tiles which are not to be traversed on, they are : (0,2),(n/2,0),(n/2,2)(n/2,4) and (n1,2). The minimum students required for class is given (k). You have to tell the minimum length of corridor to select k students.
Input
First line contains T (1<=T<=10) number test cases. Each test case consist of 1 integer K (2<=K<=10^18),
minimum number of student required.
Output
Minimum length of corridor required to select at least K student.
Note : Required length of the corridor will always be between 4 and 10000 (inclusive)
Example
Input: 2
2
9
Output: 4
6
hide comments
hardik agrawal:
20151025 00:13:18
wow! looked like dp but a deeper thought gives u a nice logic! totally adhoc ques.. :)


Rishav Goyal:
20150623 09:57:57
what the hell :D ! nice ;)


Akshay Deep:
20140831 00:25:56
really good one :) 

triveni:
20121216 08:39:43
Solved this as my 100th classical one :) 

RAHUL KUMAR:
20120718 10:24:11
what is the output for 10^18 ?? ... getting WA 

(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
20120601 16:31:45
nice problem ;) 

Sidharth Gupta:
20120307 20:35:33
@sourabh singh: i assumed it to be integer division. 

Sourabh Singh:
20120302 12:54:06
@dce coder forn/2 we nid to use floor ceil Last edit: 20120302 14:11:17 
Added by:  dce coders 
Date:  20120226 
Time limit:  2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Own Problem 