Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
|||||||||
2013-01-12 14:50:27 kamalesh
my 100th one... |
|||||||||
2012-12-19 20:55:35 Aman Verma
Guys Pls Dont forget that for n = 1 ans is 1 0 cost me 7 wrong answers and also moveeverything to long long |
|||||||||
2012-08-01 04:25:58 Simón Murillo Gómez
Nice problem. Simple greedy works |
|||||||||
2012-06-27 08:40:09 DivineAtheist
I solved using log2()...and got AC.. |
|||||||||
2012-04-15 14:02:57 god_father
I was WA again & again because of i..... guys i can be Zero & finally got AC!!! |
|||||||||
2012-01-10 17:32:04 BOND
'i' can be 'zero' also... |
|||||||||
2012-01-09 19:02:52 rahul singh
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.. |
|||||||||
2011-12-22 10:36:09 xyz
is 2^0 possible .. giving me wrong ans. plss more test cases |
|||||||||
2011-11-02 13:16:33 Srishti
can anyone tell me how to determine i in (2^i)...is it the test case t only or something else?? |
|||||||||
2011-09-13 07:49:57 Rachmawan Atmaji Perdana
Binary representations... Last edit: 2011-09-28 15:54:08 |