题意:
思路:
#include <cstdio> using namespace std; typedef long long ll; ll l,r; ll highbit(ll x){ ll res = x,cur = x; while(cur){ res = cur; cur &= res - 1; } return res; } int main(){ int t;scanf("%d",&t); while(t--){ scanf("%lld%lld",&l,&r); if(l == r) {puts("0");continue;} ll x = l^r; x = highbit(x); printf("%lld\n",(x<<1ll) - 1); } return 0; }