https://programmers.co.kr/learn/courses/30/lessons/12980
#include <vector>
using namespace std;
int solution(int n)
{
int ans = 0;
while(n!= 0){
if(n%2 != 0){ // 홀
ans++;
n--;
}else // 짝
n = n/2;
}
return ans;
}
#include <iostream>
using namespace std;
int solution(int n)
{
int ans = 0;
while(n >0)
{
ans += n%2;
n /=2;
}
return ans;
}