Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<cstdio>
- using namespace std;
- int main()
- {
- int N,X,i,test,x,one=0;
- long long int zero=0;
- cin>>test;
- for(i=1;i<=test;i++)
- {
- cin>>N>>X;
- x=X;
- while(x!=0)
- {
- if(x%2)
- ++one;
- x=x/2;
- }
- x=X;
- if(!x)
- zero=1;
- else
- {
- while(1)
- {
- if(x%2)
- break;
- ++zero;
- x=x/2;
- }
- }
- if(X)
- zero=int( pow(2,N)-zero );
- else
- zero=1;
- cout<<(one+1)<<" "<<zero<<endl;
- one=zero=0;
- }
- cin>>test;
- return 0;
- }
Add Comment
Please, Sign In to add comment