結果

問題 No.939 and or
ユーザー ngtkana
提出日時 2020-03-06 15:12:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 1,414 ms
コンパイル使用メモリ 166,716 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 02:49:24
合計ジャッジ時間 2,440 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
int main(){
    unsigned a,b;std::cin>>a>>b;
    if(a==b){
        std::cout<<1<<std::endl;
        return 0;
    }
    unsigned ans=1;
    for(;a||b;a>>=1,b>>=1){
        if(a&1u&&!(b&1u)){
            std::cout<<0<<std::endl;
            return 0;
        }
        if((a&1u)!=(b&1u))ans<<=1;
    }
    ans>>=1;
    std::cout<<ans<<std::endl;
}
0