結果

問題 No.589 Counting Even
ユーザー snrnsidy
提出日時 2021-08-23 21:47:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 1,860 ms
コンパイル使用メモリ 192,476 KB
最終ジャッジ日時 2025-01-24 01:40:23
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	long long int N;

	cin >> N;

	int cnt = 0;
	long long int temp = N;
	while(temp > 0)
	{
		if(temp%2==1)
		{
			cnt++;
		}
		temp/=2;
	}

	long long int res = (1LL << cnt) - 1;
	res = N - res;

	cout << res << '\n';
	
	return 0;
}
0