CF276D Little Girl and Maximum XOR(思路題)
阿新 • • 發佈:2019-02-19
不知道該說些什麼。。。
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define N 110
inline char gc(){
static char buf[1<<16],*S,*T;
if(S==T){T=(S=buf)+fread(buf,1,1<<16,stdin);if (T==S) return EOF;}
return *S++;
}
inline ll read(){
ll x=0,f=1;char ch=gc();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=gc();
return x*f;
}
ll l,r;
int main(){
// freopen("a.in","r",stdin);
l=read();r=read();int x=60 ;
while(x>=0){
if((r>>x&1)&&!((l>>x&1))) break;--x;
}printf("%I64d\n",(1LL<<x+1)-1);return 0;
}