hihocoder 1866 XOR
2024-08-30 12:00:24
拆位分析一下就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;
}
最新文章
- 精华 对express中next函数的一些理解
- AJAX跨域
- BZOJ4117 : [Wf2015]Weather Report
- overfit &; underfit
- linq分页扩展(转)
- Html下拉框的定义以及JS、Jquary取值、添加和移除
- in/exists not in/not exists null
- 51nod 1257 背包问题 V3
- TRANSLATE
- Codeforces 381 简要题解
- requirejs 合并方案
- CentOS环境下R语言的安装和配置
- javascript系列之核心知识点(一)
- css2.1实现图片添加阴影效果
- win7下 mysql安装(mysql-5.7.18-winx64.zip)
- Android 崩溃优化
- 确定有穷自动机(DFA)的化简(最小化)
- [精华][推荐] CAS SSO单点登录环境搭建及实例
- Linux:Day4(下) 用户及组管理
- useful tips for python
热门文章
- 2016.5.19——vector型的输入输出
- Java枚举类型的用法
- Hibernate5笔记2--单表的增删改查操作
- local variables referenced from a Lambda expression must be final or effectively final------理解
- phpStudy apache无法启动 apache启动后又停止
- OpenFlow1.3协议wireshark抓包分析
- codevs 1230 元素查找
- Python构造方法、析构方法和单例模式
- 002_curl及postman专题
- keras LSTM中间的dropout