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
|
|||||||||
2024-03-11 07:14:23
[INPUT] 2 1000000000000000000 38712498271398745 [OUTPUT] 1152921504606846976 42 72057594037927936 56 |
|||||||||
2017-04-09 14:49:56
my 100th ... easy one |
|||||||||
2017-02-07 17:03:59
After five wrong submissions finally i got AC in it..... Strictly advice not to use log function in this question it give me 5 wrong answer. |
|||||||||
2017-01-27 16:04:31
Use fast i/o in java to get rid of tle |
|||||||||
2017-01-21 06:00:31
No need to think Just code Ac in one go))... |
|||||||||
2016-04-21 09:45:39 Ray Brish Bhanu
long long everywhere and no optimization required |
|||||||||
2016-03-22 08:49:03
Easy one.. Hint: Think of the rightmost and leftmost set bits in the number. ;) |
|||||||||
2016-02-02 22:53:48
math functions in c++ and AC . |
|||||||||
2016-01-26 10:52:20 minhthai
java, runs in log(n) and still tle :( |
|||||||||
2016-01-13 10:40:09 GAURAV CHANDEL
Seems like Binary search is there to help you always... |