#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <cmath>
#include <map>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int MN = 65005;
const int MAXN = 100005;
const int INF = 0x3f3f3f3f;
#define reg register
#define IOS ios::sync_with_stdio(false)
int main(){
int ans=0;
ll l,r;
cin>>l>>r;
while((l|(l+1))<=r){
l|=l+1;
}
while(l){
ans+=l&1;
l>>=1;
}
cout<<ans<<endl;
return 0;
}
P1766 液体滴落(贪心+二进制)
最新推荐文章于 2024-11-01 17:00:11 发布