题面在这里

 

   拆位分析一下就OK啦

 

/*
    y + (y xor x)
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int n,k,ans=1;

int main(){
	scanf("%d%d",&n,&k);
	for(int i=0;i<=30;i++) if((1<<i)&n) ans<<=1;
	for(int i=29;i>=0;i--) if(!((1<<i)&n)&&(1<<(i+1))<=k) k-=1<<(i+1);
	printf("%d\n",k==0?ans:0);
	return 0;
}

  

相关文章:

  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
  • 2021-07-10
  • 2021-11-29
  • 2021-08-03
猜你喜欢
  • 2021-09-19
  • 2021-09-12
  • 2021-05-22
  • 2021-11-15
  • 2021-10-02
  • 2021-08-14
  • 2022-03-11
相关资源
相似解决方案