1、首先是要找到一个位置从左至右,作l这一个是0,r这一个是1.

2、实例01011,10100。你将能够找到01111和10000.

#include<cstdio>

#include<iostream>

using namespace std;

int main(){

long long l,r,i;

scanf("%lld%lld",&l,&r);

r=r^l;

for(i=1;;i<<=1)

if(i>r) break;

cout<<i-1<<endl;

return 0;

}

版权声明:本文博主原创文章,博客,未经同意不得转载。

Round #169 (Div. 2)D. Little Girl and Maximum XOR的更多相关文章

  1. Round #169 (Div. 2)C. Little Girl and Maximum Sum

    1.用退化的线段树(也就是没有区间查询)做... 2.注意longlong. #include<cstdio> #include<cstring> #include<io ...

  2. Codeforces Round #169 (Div. 2)

    A. Lunch Rush 模拟. B. Little Girl and Game 因为可以打乱顺序,所以只关心每种数字打奇偶性. 若一开始就是回文,即奇数字母为0或1种,则先手获胜. 若奇数字母大于 ...

  3. Codeforces Round #169 (Div. 2) E. Little Girl and Problem on Trees dfs序+线段树

    E. Little Girl and Problem on Trees time limit per test 2 seconds memory limit per test 256 megabyte ...

  4. Codeforces Round #169 (Div. 2) A水 B C区间更新 D 思路

    A. Lunch Rush time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  5. 递推水题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table

    题目传送门 /* 模拟递推水题 */ #include <cstdio> #include <iostream> #include <cmath> #include ...

  6. Codeforces Round #525 (Div. 2) D. Ehab and another another xor problem(待完成)

    参考资料: [1]:https://blog.csdn.net/weixin_43790474/article/details/84815383 [2]:http://www.cnblogs.com/ ...

  7. Codeforces Round #553 (Div. 2)B. Dima and a Bad XOR 思维构造+异或警告

    题意: 给出一个矩阵n(<=500)*m(<=500)每一行任选一个数 异或在一起 求一个 异或在一起不为0 的每行的取值列号 思路: 异或的性质  交换律 x1^x2^x3==x3^x2 ...

  8. codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...

  9. 【Trie】【枚举约数】Codeforces Round #482 (Div. 2) D. Kuro and GCD and XOR and SUM

    题意: 给你一个空的可重集,支持以下操作: 向其中塞进一个数x(不超过100000), 询问(x,K,s):如果K不能整除x,直接输出-1.否则,问你可重集中所有是K的倍数的数之中,小于等于s-x,并 ...

随机推荐

  1. Cocos2d-x 脚本语言Lua中的面向对象

    Cocos2d-x 脚本语言Lua中的面向对象 面向对象不是针对某一门语言,而是一种思想.在面向过程的语言也能够使用面向对象的思想来进行编程. 在Lua中,并没有面向对象的概念存在,没有类的定义和子类 ...

  2. dpdk组态 千兆网卡 驱动 失败 原因分析及 解决方案

    dpdk版本号是1.7.1稳定版,server它是ubuntu12.04LTS x86 64bit 绑定默认驱动程序千兆网卡ixgbe失败 # ./dpdk_nic_bind.py -b ixgbe ...

  3. Quick StateMachine状态机

    状态机quick中是一个亮点,假设我们做一款RPG游戏,一个角色通常会拥有idle,attack,walk.run,death这些状态,假设游戏角色的状态採用分支条件推断的话.会造成很庞大而难以维护. ...

  4. Enhancing the Application: Advanced JDBC Features(转)

    Enhancing the Application: Advanced JDBC Features This chapter describes additional functionality th ...

  5. HDU 1420 Prepared for New Acmer【中国剩余定理】

    /* 解决问题的思路:中国剩余定理,还要注意的是数据的类型,要使用__int64位 解决人:lingnichong 解决时间:2014-08-30 06:56:35 :简单题 */ Prepared ...

  6. 基本调试命令 - u/ub/uf

    原:http://www.cnblogs.com/developersupport/p/windbgcommand-u.html 在调试过程中难免会遇到须要反编译代码来分析逻辑的时候.在windbg中 ...

  7. git tag使用

    #git tag command git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]       ...

  8. U菜1G变化8M该解决方案

    我有一个大小1G纽曼U菜,不幸中毒一年前,格式化后你刚刚离开8M该.然后不再格式正确. 尽管只有8M,但始终我觉得扔了可惜.曾经,它已被搁置.昨天突然心血来潮,我们决定尝试.活马医.想不到最后居然被我 ...

  9. HttpLuaModule——翻译(Nginx API for Lua) (转)

    现在我已经将翻译的内容放到:http://wiki.nginx.org/HttpLuaModuleZh Nginx API for Lua Introduction 各种各样的*_by_lua和*_b ...

  10. 菜鸟版JAVA设计模式-从抽象与实现说桥接模式

    桥接模式,初学的时候事实上非常不理解为什么要把这个模式命名为桥接模式,脑海里突然联想到.事实上我学习是一件比較痛苦的事情,由于我必需要知道来龙去脉才干学的进去,所以,非常快我就对这个命名产生了兴趣,桥 ...