結果

問題 No.939 and or
ユーザー stone_725
提出日時 2019-12-02 00:25:21
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 118,912 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 15:41:42
合計ジャッジ時間 1,355 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a != (a & b)){
        cout << 0 << "\n";
        return 0;
    }
    if(a == b){
        cout << 1 << "\n";
        return 0;
    }
    int c = a ^ b;
    int ans = 1;
    while(c){
        if(c % 2){
            ans *= 2;
        }
        c /= 2;
    }
    cout << ans / 2 << "\n";
}
0