LQDCANDY - CANDY
John had a chocolate bar with the size of 2^i. At his birthday party, he shared this chocolate bar to his friend. But his friend just wanted to taste a piece of this chocolate bar which had the length of N (1 <= N <= 10^18) so that John had to break this chocolate bar into pieces to get the piece for his friend. Unfortunately, this chocolate bar was so breakable that John just can break it into half each time.
Help him find the smallest length of the chocolate bar that he needs and the minimum times of breaking the chocolate bar to get the piece for his friend.
Input
T - the number of test cases. In each of the next T lines, there is one numbers N
Output
For every test case, print one line the length of the chocolate bar and the minimum number of times to break the bar.
Example
Input: 3
8
5
7 Output: 8 0
8 3
8 3
hide comments
kamalesh:
2013-01-12 14:50:27
my 100th one... |
|
Aman Verma:
2012-12-19 20:55:35
Guys Pls Dont forget that for n = 1
|
|
Simón Murillo Gómez:
2012-08-01 04:25:58
Nice problem.
|
|
DivineAtheist:
2012-06-27 08:40:09
I solved using log2()...and got AC.. |
|
god_father:
2012-04-15 14:02:57
I was WA again & again because of i.....
|
|
BOND:
2012-01-10 17:32:04
'i' can be 'zero' also... |
|
rahul singh:
2012-01-09 19:02:52
don't use log2()..will give wrong answer(even if it is perfectly correct)..don't know why..i wasted 4-5 hrs figuring this out.. |
|
xyz:
2011-12-22 10:36:09
is 2^0 possible .. giving me wrong ans. plss more test cases |
|
Srishti:
2011-11-02 13:16:33
can anyone tell me how to determine i in (2^i)...is it the test case t only or something else??
|
|
Rachmawan Atmaji Perdana:
2011-09-13 07:49:57
Binary representations... Last edit: 2011-09-28 15:54:08 |
Added by: | Tmbao |
Date: | 2011-06-07 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | COCI |