結果

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

ソースコード

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;
    }
    if (a == b) {
        cout << 1 << endl;
        vector<int> error;
        error[0] = 1;
        return 0;
    }
    cout << pow(2LL, max(0, bitpopcount(a^b) - 1)) << endl;
    return 0;
}
0