結果

問題 No.589 Counting Even
ユーザー 0x19f
提出日時 2017-11-04 16:16:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 158,876 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-23 17:55:32
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

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

  ll cnt = 0;
  REP(i, 0, 63) if(N & (1LL << i)) cnt++;

  ll p = 1;
  REP(i, 0, cnt) p *= 2;
  cout << N + 1 - p << endl;
}
0