U E D R , A S I H C RSS

An Easy Problem/강성현

Status

Problem 2453Useranoymity
Memory736KTime16MS
LanguageG++ResultAccepted

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;
}

Trial and error

  • 려고 다가 복 기. 그냥 것 같. 바로 accept 돼 놀람

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:27
Processing time 0.0078 sec