Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main() {
- int t;
- cin>>t;
- while(t--){
- int a, b;
- cin>>a>>b;
- int count = 0;
- for(int i = a; i <= b; i++){
- while(i)
- {
- i &= (i - 1);
- count++;
- }
- }
- cout<<count<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment