627A.XOR Equation
来源:互联网 发布:如何找猎头知乎 编辑:程序博客网 时间:2024/05/16 13:50
A. XOR Equation
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputTwo 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)?
Input
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.
Output
Print a single integer, the number of solutions to the given conditions. If no solutions exist, print 0.
Examples
input
9 5
output
4
input
3 3
output
2
input
5 2
output
0
Note
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).
先贴我未通过的程序
Runtime error
当x左移1位与d==1或者d%2==1或s<x时,直接返回0
否则返回2**(bin(x).count('1'))-(0 if d else 2)
数学问题吧
0 0
- 627A.XOR Equation
- 627A - XOR Equation 数学
- CodeForces 627A XOR Equation
- Codeforces 627A XOR Equation
- Codeforces 627A XOR Equation 【数学】
- ♥codeforces 627A-XOR Equation【数学】
- CF 627A. XOR Equation 位运算
- CodeForces 627A XOR Equation(异或)
- Codeforces 627A XOR Equation【位运算实现加法】
- 【CodeForces 627A】XOR Equation(位运算)
- CodeForces 627 A.XOR Equation(位运算)
- HDU4025 Equation of XOR
- Codeforces635C XOR Equation【数学】
- C. XOR Equation
- CodeForces 635C XOR Equation(数论)
- Codeforces 635C XOR Equation (脑洞)
- CodeForces 635C XOR Equation 数学 公式
- Codeforces 635C XOR Equation【数学姿势】
- Flatten Binary Tree to Linked List | Java最短代码实现
- 年龄几何
- (有码)NSURLSession
- day60:sparkSql
- EJB介绍
- 627A.XOR Equation
- 蓝桥杯 历届试题 包含单词数
- 欢迎使用CSDN-markdown编辑器
- 个人所得税计算器
- Java类加载与实例化过程
- Java内存管理:深入Java内存区域
- String 比较
- 626A.Robot Sequence
- 在字符串中找出连续最长的数字串