CF627A.XOR Equation
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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)?
两个正整数 a 和 b 的和为 s,按位异或(XOR)结果为 x。满足条件的有序对 (a,b) 有多少种可能?
输入格式
The first line of the input contains two integers s and x (2 ≤ s ≤ 1012, 0 ≤ x ≤ 1012), the sum and bitwise xor of the pair of positive integers, respectively.
输入的第一行包含两个整数 s 和 x(2 ≤ s ≤ 1012,0 ≤ x ≤ 1012),分别表示一对正整数的和与按位异或值。
输出格式
Print a single integer, the number of solutions to the given conditions. If no solutions exist, print 0.
输出一个整数,表示满足给定条件的解的个数。若不存在解,则输出 0。
输入输出样例
输入#1
9 5
输出#1
4
输入#2
3 3
输出#2
2
输入#3
5 2
输出#3
0
说明/提示
In the first sample, we have the following solutions: (2, 7), (3, 6), (6, 3), (7, 2).
In the second sample, the only solutions are (1, 2) and (2, 1).
在第一个样例中,我们有以下解:(2,7)、(3,6)、(6,3)、(7,2)。
在第二个样例中,唯一的解是 (1,2) 和 (2,1)。
输入解题思路,AI测评打分。不知道怎么写?