結果

問題 No.939 and or
ユーザー Mayimg
提出日時 2020-01-14 07:28:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 1,925 ms
コンパイル使用メモリ 192,744 KB
最終ジャッジ日時 2025-01-08 17:55:03
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  long long a, b;
  cin >> a >> b;
  int cnt = 0;
  for (int i = 0; i < 33; i++) {
    cerr << ((a >> i) & 1) << " " << ((b >> i) & 1) << endl;
    if ((a & (1LL << i)) == 0 && (b & (1LL << i))) cnt++;
    if (((a >> i) & 1) == 1 && (b & (1LL << i)) == 0) {
      cout << 0 << '\n';
      return 0;
    }
  }
  cout << (cnt > 0 ? (long long) pow(2, cnt) / 2 : 1) << '\n';
  return 0;
}
0