結果

問題 No.680 作れる数
ユーザー kurenai3110
提出日時 2018-04-27 23:38:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 65,132 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 22:24:26
合計ジャッジ時間 1,250 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

typedef long long ll;

int main() {
	int N; cin >> N;

	bool flag = false;

	int n = ceil(N / 2.);

	for (int i = n; i < n + 100; i++) {
		int x = i;
		int cnt = 0;
		while (x) {
			if (x % 2)cnt++;
			x /= 2;
		}
		
		if (2 * i - cnt == N)flag = true;
	}

	cout << (flag ? "YES" : "NO") << endl;

	return 0;
}
0