链接:https://ac.nowcoder.com/acm/contest/332/G

题意:

求a|(a+1)|(a+2)|...|(b-1)|b。

思路:

求a-b的差的每一个二进制位

自己也看不懂。。。

代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long LL; int main()
{
LL a,b;
while(cin >> a >> b)
{
LL res = a;
LL x = 1;
while (a + x <= b)
{
res |= (x + a);
x <<= 1;
}
cout << (res|b) << endl;
} return 0;
}

  

最新文章

  1. 如何一步一步用DDD设计一个电商网站(六)—— 给购物车加点料,集成售价上下文
  2. Hive 的 map join
  3. Getting the first day in a week with T-SQL
  4. win7里边使用telnet命令提示telnet不是内部或外部命令
  5. mysql命令行登录指定编码
  6. Connection to DB
  7. ASIHTTPRequest详解
  8. “你什么意思”之基于RNN的语义槽填充(Pytorch实现)
  9. kernel pwn 入门环境搭建
  10. Python基础——6面向对象编程
  11. 记录初学者学习Hive时踩过的坑
  12. 【C++】atof()
  13. Pandas基本功能之选取索引和过滤
  14. BZOJ 3876: [Ahoi2014]支线剧情 带下界的费用流
  15. JAVA String.format 方法使用介绍&lt;转&gt;
  16. 9、Dockerfile语法
  17. LeetCode-Lowest Common Ancestor of a Binary Tre
  18. unity调用ios原生代码objective-c和回调
  19. tcp长连接分包方法
  20. 第二百二十三节,jQuery EasyUI,ComboBox(下拉列表框)组件

热门文章

  1. linux应用之samba服务的安装及配置(centos)
  2. js Date 函数方法及日期计算
  3. codeforces 669A A. Little Artem and Presents(水题)
  4. Tutte矩阵求一般图最大匹配
  5. MTK touchscreen 流程
  6. 在JS中将指定表单内的“具有name数据的表单元素的值”封装为Get形式的字符串
  7. CF-805A
  8. hdu-2563
  9. 技术胖Flutter第四季-24Flutter的打包
  10. Oracle中的集合运算