#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
ll binary(ll n)
{
ll c = 0, r = 0;
while(n != 0)
{
r = n%2;
n = n/2;
if(r == 1)
c++;
}
return c;
}
int main()
{
ll n, m, i, j;
while(cin >> m && m > 0)
{
for(j=1;j<=m;j++)
{
cin >> n;
ll b = binary(n);
ll d = 0, t = n;
i = 0;
while(t != 0)
{
ll p = t%10;
ll r = pow(16, i);
d += p*r;
t = t/10;
i++;
}
ll b1 = binary(d);
cout << b << " " << b1 << endl;
}
}
return 0;
}
#define ll unsigned long long int
using namespace std;
ll binary(ll n)
{
ll c = 0, r = 0;
while(n != 0)
{
r = n%2;
n = n/2;
if(r == 1)
c++;
}
return c;
}
int main()
{
ll n, m, i, j;
while(cin >> m && m > 0)
{
for(j=1;j<=m;j++)
{
cin >> n;
ll b = binary(n);
ll d = 0, t = n;
i = 0;
while(t != 0)
{
ll p = t%10;
ll r = pow(16, i);
d += p*r;
t = t/10;
i++;
}
ll b1 = binary(d);
cout << b << " " << b1 << endl;
}
}
return 0;
}
Comments
Post a Comment