• [E] New Year 2014

  • 时间限制: 2000 ms 内存限制: 262144 K
  • 问题描述
  • In the New Year 2014, Xiao Ming is thinking about the question: give two integers N and K, Calculate the number of the numbers of satisfy the following conditions:

    1. It is a positive integer and is not greater than N.

    2. Xor value of its all digital is K.

    For example N = 12, K = 3, the number of satisfy condition is 3 and 12 (3 = 3, 1 ^ 2 = 3).

    In order to let Xiao Ming happy in the New Year 2014, can you help him?

  • 输入
  • There are multiple test cases, each test sample contains two positive integers N and K (0 <= N, K < 10 ^ 18), End to file.
  • 输出
  • For each case, output the number of the numbers of satisfy condition in one line.
  • 样例输入
  • 12 3
    999 5
    12354 8
  • 样例输出
  • 2
    76
    662
  • 提示
  • 来源
  • 宁静致远 @HBMY
  • 操作

显示春菜