#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
ll anik(ll n)
{
if(n == 0)
return 0;
return (anik(n/2)+(n%2));
}
int main()
{
ll n, m, i;
while(cin >> m)
{
for(i=1;i<=m;i++)
{
cin >> n;
cout << anik(n) << endl;
}
}
return 0;
}
#define ll unsigned long long int
using namespace std;
ll anik(ll n)
{
if(n == 0)
return 0;
return (anik(n/2)+(n%2));
}
int main()
{
ll n, m, i;
while(cin >> m)
{
for(i=1;i<=m;i++)
{
cin >> n;
cout << anik(n) << endl;
}
}
return 0;
}
Comments
Post a Comment