結果

問題 No.680 作れる数
ユーザー square1001
提出日時 2018-06-01 20:23:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 63,996 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 08:55:23
合計ジャッジ時間 1,635 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int popcount(int n) {
	int ret = 0;
	while (n > 0) ret += n & 1, n >>= 1;
	return ret;
}
int main() {
	int n;
	cin >> n;
	bool f = false;
	for (int i = n % 2; i < 30; i += 2) {
		if (popcount(n + i) == i) f = true;
	}
	cout << (f ? "YES\n" : "NO\n");
	return 0;
}
0