#abc213a. A - Bitwise Exclusive Or

A - Bitwise Exclusive Or

Score : 100100 points

问题陈述

给定两个在 00255255(包含)之间的整数 AABB。求一个非负整数 CC,使得 A xor C=BA \text{ xor } C = B

可以证明这样的 CC 存在且唯一,并且它也会在 00255255(包含)之间。

什么是按位异或?

整数 AABB 的按位异或(XOR\mathrm{XOR}),记作 A XOR BA\ \mathrm{XOR}\ B,定义如下:

  • 当以二进制形式表示 A XOR BA\ \mathrm{XOR}\ B 时,第 2k2^k 位(k0k \geq 0)上的数字是:如果 AABB 中恰好有一个为 11,则该位为 11;否则为 00

例如,我们有 3 XOR 5=63\ \mathrm{XOR}\ 5 = 6(以二进制表示:011 XOR 101=110011\ \mathrm{XOR}\ 101 = 110)。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given integers AA and BB between 00 and 255255 (inclusive). Find a non-negative integer CC such that A xor C=BA \text{ xor }C=B.

It can be proved that there uniquely exists such CC, and it will be between 00 and 255255 (inclusive).

What is bitwise XOR\mathrm{XOR}?

The bitwise XOR\mathrm{XOR} of integers AA and BB, A XOR BA\ \mathrm{XOR}\ B, is defined as follows:

  • When A XOR BA\ \mathrm{XOR}\ B is written in base two, the digit in the 2k2^k's place (k0k \geq 0) is 11 if exactly one of AA and BB is 11, and 00 otherwise.

For example, we have 3 XOR 5=63\ \mathrm{XOR}\ 5 = 6 (in base two: 011 XOR 101=110011\ \mathrm{XOR}\ 101 = 110).

Constraints

  • 0A,B2550\leq A,B \leq 255
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

AA BB

Output

Print the answer.

Sample Input 1

3 6

Sample Output 1

5

When written in binary, 33 will be 1111, and 55 will be 101101. Thus, their xor\text{xor} will be 110110 in binary, or 66 in decimal.

In short, 3 xor 5=63 \text{ xor } 5 = 6, so the answer is 55.

Sample Input 2

10 12

Sample Output 2

6

Figure

update @ 2024/3/10 09:29:04