結果

問題 No.939 and or
ユーザー t33f
提出日時 2019-12-15 10:21:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 64,000 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 18:10:17
合計ジャッジ時間 1,413 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main() {
    int A, B; cin >> A >> B;
    long long ans = 1;
    for (int i = 0; i <= 30; i++) {
        int a = (A >> i) & 1, b = (B >> i) & 1;
        if (a > b) ans = 0;
        else if (a == 0 && b == 1) ans *= 2;
    }
    cout << (ans == 1 ? 1 : ans/2) << endl;
}
0