Status ¶
| Problem | 2453 | User | anoymity | 
| Memory | 736K | Time | 16MS | 
| Language | G++ | Result | Accepted | 
Idea ¶
- 1의 갯수를 구한뒤에 i를 하나씩 늘려가면서 1의 갯구를 비교
 
 
Source Code ¶
#include <iostream>
using namespace std;
int main(void) {
	while (1) {
		int i, c = 0;
		cin >> i;
		if (i == 0) break;
		int temp = i;
		while (temp>0) { c+=temp%2; temp>>=1;}
		while (1) {
			int temp = ++i, cc = 0;
			while (temp>0) { cc+=temp%2; temp>>=1;}
			if (cc == c) break;
		}
		cout << i << endl;
	}
	return 0;
}













