結果

問題 No.1432 Not Xor
ユーザー tardigradetardigrade
提出日時 2021-03-19 21:49:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 967 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 164,524 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-12 01:50:19
合計ジャッジ時間 2,188 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define pb push_back
#define em emplace_back
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vd vector<double>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define fast  \
  cin.tie(0); \
  ios::sync_with_stdio(false);
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
  fast;
  ll a, b;
  cin >> a >> b;
  ll p = 1;
  ll ans = 0;
  while (a != 0 || b != 0) {
    if (a % 2 && b % 2) {
      ans += p;
    }
    if (a % 2 || b % 2) {
      ans += p;
    }
    p *= 2;
    a /= 2;
    b /= 2;
  }
  cout << ans << endl;
  return 0;
}
0