102130: [AtCoder]ABC213 A - Bitwise Exclusive Or

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

Score : $100$ points

Problem Statement

You are given integers $A$ and $B$ between $0$ and $255$ (inclusive). Find a non-negative integer $C$ such that $A \text{ xor }C=B$.

It can be proved that there uniquely exists such $C$, and it will be between $0$ and $255$ (inclusive).

What is bitwise $\mathrm{XOR}$?

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

  • When $A\ \mathrm{XOR}\ B$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if exactly one of $A$ and $B$ is $1$, and $0$ otherwise.
For example, we have $3\ \mathrm{XOR}\ 5 = 6$ (in base two: $011\ \mathrm{XOR}\ 101 = 110$).

Constraints

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

Input

Input is given from Standard Input in the following format:

$A$ $B$

Output

Print the answer.


Sample Input 1

3 6

Sample Output 1

5

When written in binary, $3$ will be $11$, and $5$ will be $101$. Thus, their $\text{xor}$ will be $110$ in binary, or $6$ in decimal.

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


Sample Input 2

10 12

Sample Output 2

6

Figure

Input

题意翻译

对 $a,b$ 两个非负整数执行异或位运算并输出其结果。

Output

分数:100分

问题描述

给你两个介于0和255(含)之间的整数A和B。找出一个非负整数C,使得A异或C=B。

可以证明存在一个这样的C,且C介于0和255(含)之间。

什么是按位异或?

整数A和B的按位异或A 异或 B,表示为$A\ \mathrm{XOR}\ B$,定义如下:

  • 当$A\ \mathrm{XOR}\ B$以二进制表示时,第$2^k$位($k \geq 0$)为1,如果A和B中恰好有一个为1,否则为0。
例如,我们有$3\ \mathrm{XOR}\ 5 = 6$(以二进制表示:$011\ \mathrm{XOR}\ 101 = 110$)。

约束

  • $0\leq A,B \leq 255$
  • 输入中的所有值都是整数。

输入

从标准输入给出以下格式的输入:

$A$ $B$

输出

打印答案。


样例输入1

3 6

样例输出1

5

当以二进制表示时,3为11,5为101。因此,它们的异或为二进制的110,即十进制的6。

简而言之,$3 \text{ xor } 5 = 6$,所以答案是5。


样例输入2

10 12

样例输出2

6

Figure

加入题单

算法标签: