結果
問題 | No.939 and or |
ユーザー |
![]() |
提出日時 | 2019-12-03 20:54:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,108 bytes |
コンパイル時間 | 1,145 ms |
コンパイル使用メモリ | 112,204 KB |
最終ジャッジ日時 | 2025-01-08 07:17:07 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <string> #include <stack> #include <queue> #include <map> #include <set> #include <tuple> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cassert> #include <cstdint> #include <numeric> #include <bitset> #include <functional> using namespace std; using ll = long long; using Pll = pair<ll, ll>; using Pii = pair<int, int>; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll a, b; cin >> a >> b; ll ans = 1LL; for(int i=0;i<31;++i) { if((a >> i) & 1) { if((b >> i) & 1) { continue; } else { ans = 0LL; break; } } else { if((b >> i) & 1) { ans *= 2LL; } else { continue; } } } if(ans != 1LL) ans /= 2LL; cout << ans << endl; }