AtCoder Regular Contest 133
D
Range XOR
AtCoder
⌀ 2658
原题
← CE →
翻译中…

Problem Statement

翻译中…

Given are integers $L$, $R$, and $V$. Find the number of pairs of integers $(l,r)$ that satisfy both of the conditions below, modulo $998244353$.

翻译中…
  • $L \leq l \leq r \leq R$
  • $l \oplus (l+1) \oplus \cdots \oplus r=V$
翻译中…

Here, $\oplus$ denotes the bitwise $\mathrm{XOR}$ operation.

翻译中…

What is bitwise $\mathrm{XOR}$? The bitwise $\mathrm{XOR}$ of non-negative 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$). Generally, the bitwise $\mathrm{XOR}$ of $k$ integers $p_1, p_2, p_3, \dots, p_k$ is defined as $(\dots ((p_1 \oplus p_2) \oplus p_3) \oplus \dots \oplus p_k)$. We can prove that this value does not depend on the order of $p_1, p_2, p_3, \dots p_k$.

翻译中…

Constraints

翻译中…
  • $1 \leq L \leq R \leq 10^{18}$
  • $0 \leq V \leq 10^{18}$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

L R V

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
1 3 3
Output #1
2
The two pairs satisfying the conditions are $(l,r)=(1,2)$ and $(l,r)=(3,3)$.
Input #2
10 20 0
Output #2
6
Input #3
1 1 1
Output #3
1
Input #4
12345 56789 34567
Output #4
16950
题目信息
题号
arc133_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。