結果

問題 No.638 Sum of "not power of 2"
ユーザー ldsybldsyb
提出日時 2018-07-27 21:40:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 412 bytes
コンパイル時間 1,416 ms
コンパイル使用メモリ 165,124 KB
実行使用メモリ 11,980 KB
最終ジャッジ日時 2023-09-18 04:44:59
合計ジャッジ時間 5,954 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int64_t n;
	cin >> n;
	auto bit_count = [](int64_t x) {
		int64_t r = 0;
		for (; x; x >>= 1)
		{
			r += (x & 1);
		}
		return r;
	};
	for (int64_t a = 1; a < 10000000; a++)
	{
		int64_t b = n - a;
		if ((bit_count(a) == 1) || (bit_count(b) == 1))
		{
			continue;
		}
		cout << a << ' ' << b << endl;
		return 0;
	}
	cout << -1 << endl;
	return 0;
}
0