結果

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

ソースコード

diff #

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

int main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  if ((A & B) != A) ans = 0;
  else if (A == B) ans = 1;
  else ans = 1 << (__builtin_popcount(B - A) - 1);
  cout << ans << "\n";
}
0