結果

問題 No.2853 A + B Problem
ユーザー elphe
提出日時 2024-12-05 17:34:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 65,612 KB
最終ジャッジ日時 2025-02-26 11:06:01
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>

using namespace std;

constexpr uint16_t pop_count(uint64_t a) noexcept
{
	uint16_t ans = UINT16_C(0);
	for (; a != UINT64_C(0); a >>= UINT64_C(1))
		if(a & UINT64_C(1)) ++ans;

	return ans;
}

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	uint64_t N;
	cin >> N;

	cout << ((UINT64_C(1) << pop_count(N)) - 2) << '\n';
	return 0;
}
0