728x90
programmers.co.kr/learn/courses/30/lessons/12911
#include <string>
#include <vector>
#include <bitset>
#include <iostream>
using namespace std;
int ijin(int num ){
int i =1;
int count=0;
while(i<=num){
if((num&i)){
count++;
}
i= i<<1;
}
return count;
}
int solution(int n) {
int answer = 0;
int count =0;
int cmp = n;
int ncount = ijin(n);
while(count!=ncount){
cmp ++;
count = ijin(cmp);
}
answer = cmp;
return answer;
}