結果
問題 | No.939 and or |
ユーザー | fine |
提出日時 | 2019-12-02 23:56:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 1,344 ms |
コンパイル使用メモリ | 166,336 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 01:49:46 |
合計ジャッジ時間 | 2,118 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int a, b; cin >> a >> b; int cnt = 0; for (int i = 0; i < 31; ++i) { bool fAND = (a & (1 << i)) > 0; bool fOR = (b & (1 << i)) > 0; if (fAND && !fOR) { cout << 0 << "\n"; return 0; } if (fAND || !fOR) continue; cnt++; } cout << (1 << max(cnt - 1, 0)) << "\n"; return 0; }