#2782. XOR World

0
    ID: 2782 传统题 2000ms 1024MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>AtCoderabc121DGESP 5级位运算(复杂)数论

XOR World

XOR World

题目描述

Let f(A,B)f(A, B) be the exclusive OR of A,A+1,...,BA, A+1, ..., B. Find f(A,B)f(A, B).

What is exclusive OR?
The bitwise exclusive OR of integers $c_1, c_2, ..., c_n$ (let us call it $y$) is defined as follows:

When yy is written in base two, the digit in the 2k2^k's place (k≥0k \geq 0) is 11 if, the number of integers among c1,c2,...cmc_1, c_2, ...c_m whose binary representations have 11 in the 2k2^k's place, is odd, and 00 if that count is even.

For example, the exclusive OR of 33 and 55 is 66. (When written in base two: the exclusive OR of 011011 and 101101 is 110110.)

输入格式

Input is given from Standard Input in the following format: AA BB

输出格式

Compute f(A,B)f(A, B) and print it.

2 4
5
123 456
435
123456789012 123456789012
123456789012

提示

All values in input are integers. 0≤A≤B≤10120 \leq A \leq B \leq 10^{12}2,3,42, 3, 4 are 010010, 011011, 100100 in base two, respectively. The exclusive OR of these is 101101, which is 55 in base ten.

标签: AtCoder|abc121D

来源

AtCoder|abc121D