結果

問題 No.939 and or
ユーザー 🍮かんプリン
提出日時 2019-12-02 01:34:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 158,056 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-22 02:04:20
合計ジャッジ時間 2,642 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int bitpopcount(ll n) {
    int res = 0;
    while (n) {
        if (n & 1) res++;
        n >>= 1;
    }
    return res;
}

int main() {
    ll a, b; cin >> a >> b;
    if ((a | b) != b) {
        cout << 0 << endl;
        return 0;
    }
    cout << pow(2LL, max(0, bitpopcount(a^b) - 1)) << endl;
    return 0;
}
0