#include <iostream>usingnamespace std;
int n;
int a[1000];
intf(int x)
{
int ret =0;
for (; x; x &= x -1) ret++;
return ret;
}
intg(int x)
{
return x &-x;
}
intmain()
{
cin >> n;
for (int i =0; i < n; i++) cin >> a[i];
for (int i =0; i < n; i++)
cout << f(a[i]) + g(a[i]) <<' ';
cout << endl;
return0;
}
Time limit: 0
Quiz Summary
0 of 6 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.