結果
問題 | No.939 and or |
ユーザー |
|
提出日時 | 2019-12-02 09:30:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 748 bytes |
コンパイル時間 | 934 ms |
コンパイル使用メモリ | 87,660 KB |
最終ジャッジ日時 | 2025-01-08 06:40:18 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <utility> #include <string> #include <cstdlib> #include <queue> using namespace std; typedef long long int ll; typedef pair<int, int> Pii; const ll mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b; cin >> a >> b; vector<bool> x(32), y(32); for (int i = 0; i < 32; i++) { x[i] = (a & 1); y[i] = (b & 1); a >>= 1; b >>= 1; } int c = 0; for (int i = 0; i < 32; i++) { if (x[i] && !y[i]) { cout << 0 << endl; // impossible return 0; } else if (!x[i] && y[i]) c++; } int ans = 1; for (int i = 0; i < c - 1; i++) ans <<= 1; cout << ans << endl; return 0; }