AtCoder Regular Contest 129
翻译中…
Problem Statement
翻译中…
Given are integers $N$, $L$, and $R$. Count the number of integers $x$ that satisfy both of the following conditions.
翻译中…
$L \leq x \leq R$$(x \oplus N) < N$(Here,$\oplus$denotes the bitwise$\mathrm{XOR}$.)
翻译中…
What is the bitwise $\mathrm{XOR}$? The bitwise $\mathrm{XOR}$ of integers $A$ and $B$, $A\oplus B$, is defined as follows: When $A\oplus B$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if exactly one of $A$ and $B$ is $1$, and $0$ otherwise. For example, we have $3\oplus 5 = 6$ (in base two: $011\oplus 101 = 110$).
翻译中…
Constraints
翻译中…
$1 \leq N \leq 10^{18}$$1 \leq L \leq R \leq 10^{18}$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N L R
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
2 1 2
Output #1
1
For $x=1$, $L \leq x \leq R$ is satisfied, but $(x \oplus N) < N$ is not. For $x=2$, both conditions are satisfied. There is no other $x$ that satisfies the conditions.
Input #2
10 2 19
Output #2
10
Input #3
1000000000000000000 1 1000000000000000000
Output #3
847078495393153025
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。