题库练习 XOR Equation
← 上一题 下一题 →

A10203 | XOR Equation

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Two positive integers $a$ and $b$ have a sum of $s$ and a bitwise XOR of $x$ . How many possible values are there for the ordered pair $(a,b)$ ?

输入格式

The first line of the input contains two integers $s$ and $x$ ( $2<=s<=10^{12}$ , $0<=x<=10^{12}$ ), the sum and bitwise xor of the pair of positive integers, respectively.

输出格式

Print a single integer, the number of solutions to the given conditions. If no solutions exist, print $0$ .

输入输出样例

输入 #1
9 5
输出 #1
4
输入 #2
3 3
输出 #2
2
输入 #3
5 2
输出 #3
0
C++ 编辑器
输入
输出