Submit | All submissions | Best solutions | Back to list |
LQDCANDY - CANDY |
John had a chocolate bar with the size of 2i. 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 ≤ 1018) 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-10-24 16:48:26 joker23
I don't know if this has already been posted but JAVA USERS: use BufferedReader to read stdin and PrintWriter to output...even if you use BufferedReader, System.out will still time you out |
|||||||||
2013-08-07 07:42:29 Ayush Vatsa
nice 1....thanx @aman verma |
|||||||||
2013-07-26 14:45:40 Rana Saha
Last edit: 2013-08-05 20:56:13 |
|||||||||
2013-07-14 10:25:49 chicku
Easier when bit level programming not used |
|||||||||
2013-07-10 20:03:00 Vipul Pandey
my 100th submission. just little bit level programming... Last edit: 2013-07-10 20:04:41 |
|||||||||
2013-06-12 08:25:58 Ouditchya Sinha
Piece of Cake. :) |
|||||||||
2013-06-09 06:00:31 $!:D
play with bits ;) |
|||||||||
2013-05-15 17:37:52 hemalatha
not taking long long costed me 1 wa |
|||||||||
2013-03-05 20:45:20 a b
vry silly mistake..... tak care of type conversion |