結果

問題 No.2853 A + B Problem
ユーザー ochiaigawa
提出日時 2024-08-25 13:40:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 194,336 KB
最終ジャッジ日時 2025-02-24 00:52:28
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  int cnt = 0;
  for(int i = 0; i < 60; i++) {
    cnt += (N >> i & 1 ? 1 : 0);
  }
  if(cnt == 1) {
    cout << 0 << '\n';
  } else {
    long long ans = 1;
    for(int i = 1; i < cnt; i++) {
      ans *= 2;
    }
    cout << ans << '\n';
  }
  return 0;
}
0