All submissions for this problem are available.
In a world full of numbers, you are given ‘N’ blocks of value 2. Your target is to merge these blocks in such a way that one bigger number is formed. The merging takes place as follows : Two blocks of value 2 will make one block of value 4, then two block of value 4 will make one block of value 8 and so on. At any step, after merging, if there is a block left, then that block is automatically upgraded to next higher value. You need to find out the numbers of block merges required to get largest number possible.
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
Each test case contains a number ‘N’ i.e. number of blocks of value 2
The number of block merges required to get the largest number possible
Sample Input Explanation
5 blocks of 2s will make 2 blocks of 4 and one block of 2 will be upgraded to 4. Now 2 blocks of 4 will make one block 8 and one block of 4 will be upgraded to 8. Finally 2 blocks of 8 will make one block of 16 (which is the largest number possible).
Hence number of merges required are: 2 + 1 + 1 = 4
- 1 <= T <= 100000
- 1 ≤ Ni ≤ 10000000000
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions