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
|
|||||||||
2011-08-29 17:39:25 vipin
whats the output when the input is 100? Is it "128 5"? edit: AC..:) for 100 , output is "128 5". Last edit: 2011-08-29 18:03:38 |
|||||||||
2011-07-21 12:09:45 Konsta Kanellis
Be carefull of the way you are reading the input. |
|||||||||
2011-07-21 08:02:50 黄俊翔
when I used long,I got wa when I used long long,I got TLE How large is T?!! |
|||||||||
2011-07-01 00:18:43 Abdelrahman Hatem
@Todd B server of spoj is slower than you laptop |
|||||||||
2011-06-21 08:09:43 Santiago Zubieta
Hmmm got AC using a cycle to find the i in 2^i... but using log2(bar size) it gives me WA... And I'm even checking afterwards if the result of that log isn't exact, to round it up. Last edit: 2011-06-21 08:10:29 |
|||||||||
2011-06-18 00:26:43 shinoda
success... Last edit: 2011-06-18 01:06:02 |
|||||||||
2011-06-17 14:59:18 mukesh tiwari
after solving this , try https://www.spoj.pl/problems/SILVER/ |
|||||||||
2011-06-16 10:11:53 Suresh Iyengar
Can you explain the test data. Why is the output 8 3 for input N=5. Got it. 5 => 8/2-> 4, 4/2-> 2, 2/2-> 1 Last edit: 2011-06-17 15:14:59 |
|||||||||
2011-06-16 03:05:25 bashrc is back
The test case data are definitely random.My same code without any modifications has time .01-0.05 s for different submissions. |
|||||||||
2011-06-15 03:40:12 sudipto das
Remember i starts from '0' (for 2^i) |