This question is said to be water problem, is not done out, see a lot of problems, feel this law did not understand, later in the discussion area saw a question, feel a little understand, write your own understanding
First of all, to understand the meaning of different or simple sentence: the same as 0 different 1, since this, let the interval a, a, or the largest one, then the largest group is how much, thanks to a few sets of data, first to find out the value of a ^ B, because this is the most basic, so x=a^b, then x binary first 1 should appear in B 1, And a is 0, because B > A, this can be a hands-on experiment, then because the arbitrary two number is located between A and B, so, this arbitrary two number of bits number must be less than or equal to x bits number, because he is an interval, So you can certainly find that the first 1 of the X's binary is all 1, then this maximum value, this time also becomes the x bits number is all 1, so n = x bits number, the result is 2^n-1, for example, 5 and 7, then 5 binary 101, 7 binary 111, 5^7=010, the first 1 appears in the second position, then 1 to the right of the 0 must be able to change the value of two numbers, that is, the maximum to 5, 6, so the XOR is 3, the binary is 11, so that is 2^2-1 = 3;
The code is as follows:
1 2#include <cstdio>3 4 using namespacestd;5 6 intMain ()7 {8 9 Long LongA, B;Ten while(~SCANF ("%lld%lld", &a, &b)) One { A - Long Longx = a ^b; - intc =0; the while(x) - { -C++; -X >>=1; + } - Long Longres =1; + for(inti =0; I < C; i++) A { atRes *=2; - } -printf"%lld\n", RES-1); - } - return 0; -}
The problem of NYOJ-744 ants (i.)