結果

問題 No.939 and or
ユーザー plin92793134plin92793134
提出日時 2019-12-19 00:03:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,058 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 100,096 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 23:03:52
合計ジャッジ時間 1,730 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;




int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b;cin>>a>>b;
  if((a&b)!=a){cout<<0<<endl;return 0;}
  ll cnt=1;
  ll c=b^a;
  while(c>0){
    if(c%2)cnt<<=1;
    c>>=1;
  }
  if(cnt==1)cnt<<=1;
  cout<<cnt/2<<endl;


  return 0;

}
0