No.2533 A⇒B Problem
Problem Statement
You are given $2$ non-negative integers $A,B$ as input.
We write $A \Rightarrow B$ to denote that $A,B$ satisfy the following property.
- For any non-negative integer $d$, if the $2^d$'s place in the binary representation of $A$ is $1$, then the $2^d$'s place in the binary representation of $B$ is also $1$.
Click here for an explanation for those unfamiliar with binary representation. (Click to expand)
For non-negative integers $n$ and $d$, the $2^d$'s place in the binary representation of $n$ is the remainder when the quotient of $n$ divided by $2^d$ is divided by $2$.
Determine whether $A \Rightarrow B$ is true or false.
Input
The input is given from standard input in the following format:$A$ $B$
$A,B$ are given on $1$ line, separated by a single-byte space.
Constraints
The input satisfies the following constraints:
- $A$ is an integer satisfying $0 \leq A \leq 10^9$
- $B$ is an integer satisfying $0 \leq B \leq 10^9$
Output
Print Yes if $A \Rightarrow B$ is true, and No if it is false, on $1$ line.
Print a newline at the end.
Sample
Sample 1
Input
0 0
Output
Yes
Since $A = B$, the binary representations of $A$ and $B$ are equal. Therefore, $A \Rightarrow B$ is true.
Sample 2
Input
0 1
Output
Yes
Every place in the binary representation of $A = 0$ is $0$. Therefore, $A \Rightarrow B$ is true.
Sample 3
Input
3 1
Output
No
The $2^1$'s place of $A = 3 = 1 \times 2^1 + 1 \times 2^0$ is $1$. On the other hand, the $2^1$'s place of $B = 1 = 0 \times 2^1 + 1 \times 2^0$ is $0$. Therefore, $A \Rightarrow B$ is false.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。