Problem | 2453 | User | anoymity |
Memory | 736K | Time | 16MS |
Language | G++ | Result | Accepted |
#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; }