题面:
思路:
代码:
#includeusing namespace std;long long l,r,ans,x=1,n,f;int main(){ freopen("zvrk.in","r",stdin); freopen("zvrk.out","w",stdout); scanf("%lld%lld",&l,&r); l--; while(l){ f=l&1; l>>=1; ans-=x*(l+f); x<<=1; } x=1; while(r){ f=r&1; r>>=1; ans+=x*(r+f); x<<=1; } printf("%lld",ans); return 0;}