結果

問題 No.939 and or
ユーザー ku_senjan
提出日時 2023-06-04 10:56:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 1,585 ms
コンパイル使用メモリ 166,536 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-29 03:26:57
合計ジャッジ時間 2,651 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  ll A, B; cin >> A >> B;

  ll ans = 1;
  for(int dgt=0; dgt<32; dgt++){
    ll msk = 1LL<<dgt;
    bool a = A&msk, b = B&msk;
    if(a && !b) ans = 0;
    if(!a && b) ans *= 2;
  }
  ans = (ans+1)/2;
  cout << ans << endl;
}
0