303221: CF627A. XOR Equation
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
XOR Equation
题意翻译
## 题目描述 两个合法的正整数 $a$ 和 $b$ 的和为 $s$,它们的按位异或和为 $x$。请计算出所有可能的有序数对 $(a,b)$ 的个数。 ## 输入格式 输入共一行,包含两个整数 $s(2\leq s\leq 10^{12})$ 和 $x(2\leq x\leq 10^{12})$。 ## 输出格式 输出一个整数,为合法的有序数对的个数。如果不存在合法的数对,则输出 $0$。 ## 样例解释 对于第一个样例,有以下合法的数对:$(2,7)$ $(3,6)$ $(6,3)$ $(7,2)$; 对于第二个样例,有以下合法的数对:$(1,2)$ $(2,1)$。题目描述
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