IIITA1 - Playing With Bits
Maaz and Aradhya are quite brilliant students of Mathematics and Programming respectively. One day, their Mathematics Professor Mr. K.P. Singh asked them to solve a Mathematics problem.
Given two number A and B, find the minimum number of bits required to convert binary representation of A into binary representation of B.
Maaz promised Mr. K.P. Singh that he will be the first one to solve the problem but Aradhya decided to do it before him. He turns to you for help. Will you be able to help him?
Input
Input consists of t (number of test cases), then t lines follows, each containing two integers A and B (1 <= A, B <= 2^31)
Output
A single line containing the minimum number of bits required to convert binary representation of A into binary representation of B.
Example
Input: 2
14 31
56 68
Output:
2
5
Time Limit is kept very strict. Any naive algorithm will never be accepted.
hide comments
victor gomez:
2013-05-15 07:56:15
can some one doa tutorial, i need to solve this problem for a final exam; //plis should be in C++ Last edit: 2013-05-15 07:57:11 |
|
:D:
2012-08-26 21:15:52
Please don't set up such ridiculous times in the main problem set.
|
|
StupidGuy:
2012-08-26 16:31:09
So, finally tutorial it is... |
|
Shubham:
2012-08-26 16:31:09
@better late than never,problemID 7534417 and 7534410 are exactly the same but one got accepted and other one showed TLE. And by exact I mean exact.look into this please.
|
|
mehmetin:
2012-08-26 16:31:09
As pointed out by S#!THAPPEN$, the judge can give TLE for no reason. It happens with other problems too. It must have something to do with the system. |
|
Francky:
2012-08-26 16:31:09
Solution had been rejudged and I loose my 0.07s :-(
|
|
Secret:
2012-08-26 16:31:09
it should be moved to tutorial . |
|
Alex Anderson:
2012-08-26 16:31:09
This should be tutorial or challenge. |
|
Aradhya:
2012-08-26 16:31:09
:D check my submissions in id's 7532238 and 7532240.. not even a single character change :D one AC and one TLE.. lol on spoj machines |
|
Aradhya:
2012-08-26 16:31:09
my c++ code which took 0.09 sec ,, got TLE in PYTH o.O.. reset the time limit snehasish |
Added by: | Better late than never !!! |
Date: | 2012-08-25 |
Time limit: | 0.100s |
Source limit: | 500B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Navneet Sir |