CF627A.XOR Equation

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Two positive integers aa and bb have a sum of ss and a bitwise XOR of xx . How many possible values are there for the ordered pair (a,b)(a,b) ?

输入格式

The first line of the input contains two integers ss and xx ( 2<=s<=10122<=s<=10^{12} , 0<=x<=10120<=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 00 .

输入输出样例

  • 输入#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)(2,7) , (3,6)(3,6) , (6,3)(6,3) , (7,2)(7,2) .

In the second sample, the only solutions are (1,2)(1,2) and (2,1)(2,1) .

首页