AtCoder Beginner Contest 121
翻译中…
Problem Statement
翻译中…
Let $f(A, B)$ be the exclusive OR of $A, A+1, ..., B$. Find $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 $y$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if, the number of integers among $c_1, c_2, ...c_m$ whose binary representations have $1$ in the $2^k$'s place, is odd, and $0$ if that count is even. For example, the exclusive OR of $3$ and $5$ is $6$. (When written in base two: the exclusive OR of 011 and 101 is 110.)
翻译中…
Constraints
翻译中…
- All values in input are integers.
$0 \leq A \leq B \leq 10^{12}$
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
A B
翻译中…
Output
翻译中…
Compute $f(A, B)$ and print it.
翻译中…
样例
Input #1
2 4
Output #1
5
$2, 3, 4$ are `010`, `011`, `100` in base two, respectively. The exclusive OR of these is `101`, which is $5$ in base ten.
Input #2
123 456
Output #2
435
Input #3
123456789012 123456789012
Output #3
123456789012
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。