結果
問題 | No.939 and or |
ユーザー | tac |
提出日時 | 2019-12-21 11:55:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,041 bytes |
コンパイル時間 | 1,342 ms |
コンパイル使用メモリ | 165,516 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 05:17:51 |
合計ジャッジ時間 | 2,249 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define pii pair<int, int> #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep3(i, l, n) for (int i = l; i < (n); ++i) #define sz(v) (int)v.size() #define inf (int)(1e9+7) #define INF (ll)(1e18) #define abs(x) (x >= 0 ? x : -(x)) #define ceil(a, b) a / b + !!(a % b) template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; } template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; } template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int a, b; cin >> a >> b; ll ans = 1; while (a || b) { if (a % 2 == 1 && b % 2 == 0) { cout << 0 << endl; return 0; } if (a % 2 == 0 && b % 2 == 1) ans *= 2; a /= 2; b /= 2; } cout << (ans == 1 ? ans : ans / 2) << endl; }