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. SoccerLeagueDB

    create table if not exists League ( lid int primary key auto_increment,      lyear int not null,   s ...

  2. ubuntu12.04 安装和配置jdk1.7

    第一步:下载jdk-7-linux-i586.tar.gz wget -c http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586 ...

  3. PHPCMS V9{loop subcat(0,0,0,$siteid) $r}怎么解释?

    {loop subcat(0,0,0,$siteid) $r}{/loop} /** * 获取子栏目  * @param $parentid 父级id   * @param $type 栏目类型  * ...

  4. ajax j跨域请求sonp

    需求 遇到的问题 解决方案 需求 如今,该项目需要获得数据访问外部链接.它是跨域.使用ajax 直提示: 遇到的问题 1. 怎样使用ajax 跨域请求数据 2. 能不能post请求 解决的方法 经过网 ...

  5. Google Maps Android API v2 (3)- 地图添加到Android应用程序

    添加地图的基本步骤是: (一旦)按照以下步骤[入门] [开始],获得API,获取密钥所需的属性,并添加到您的Android清单. 添加一个碎片对象 要处理地图的活动.做到这一点最简单的方法是增加一个  ...

  6. simple factory, factory method, abstract factory

    simple factory good:1 devide implementation and initialization2 use config file can make system more ...

  7. Android Splash界面支持用户点击 直接进入主界面

    转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/23613403 现在大部分APP都有Splash界面,下面列一下Splash页面的 ...

  8. linux 脚本測试网络速度

    example: ./netspeed eth0 1 #!/bin/bash 2   3 INTERVAL="1"  # update interval in seconds   ...

  9. JSON连载java目的

    一. 前台(JS  面向对象) 1. 定义SearchView对象 function SearchView() { } SearchView.prototype.setViewName = funct ...

  10. [生产环境数据恢复]innobackupex: fatal error: OR no &#39;datadir&#39; option in group &#39;mysqld&#39; in MySQL options

    1 运行恢复命令  [xxx@xxx-c001db1 tmp]$ time /usr/bin/innobackupex --rsync --user="user" --passwo ...