結果

問題 No.589 Counting Even
ユーザー vjudge1
提出日時 2025-08-27 11:40:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 1,148 ms
コンパイル使用メモリ 154,548 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-27 11:40:07
合計ジャッジ時間 2,351 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,cnt=0;
inline int lowbit(int x){return x&-x;}
signed main(){
	cin>>n;
	int res=n+1;
	while(n){
		n-=lowbit(n);
		cnt++;
	}
	cout<<res-(1ll<<cnt);
}

0