結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a;
        a=a*a;
        b/=2;
    }
    return ans;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A,B;cin>>A>>B;
    int cnt=0;
    for(int i=0;i<32;i++){
        if(!(A&(1<<i))&&B&(1<<i)) cnt++;
        if(A&(1<<i)&&!(B&(1<<i))) cnt=-100;
    }
    if(cnt<0) cout<<0<<endl;
    else cout<<rui(2,cnt-1)<<endl;
    
}
0