問題一覧 > 教育的問題

No.2533 A⇒B Problem

レベル : / AI推定難易度 : 189 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 151
作問者 : 👑 p-adic / テスター : hiro1729
お気に入りにしたユーザー ProblemId : 9931 / 自分の提出
問題文最終更新日: 2023-09-04 20:35:33
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 412 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。