問題一覧 > 通常問題

No.2863 Base 10 Subsets 1

レベル : / AI推定難易度 : 130 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 141
作問者 : yuusaan / テスター : 寝癖 👑 seekworser
お気に入りにしたユーザー ProblemId : 11104 / 自分の提出
問題文最終更新日: 2024-08-30 21:10:19
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 443 (順位表) の他の問題:

Story

Yu~-san, a researcher, had a drinking party today. Apparently something unpleasant happened there, and now Yu~-san is complaining to you, the assistant.

"...and so, that senior of mine makes no sense at all. He goes, 'Obviously you guys don't order anything more expensive than mine, but doing that on some digit is also a challenge to me, right?'

In other words, your order amount is not allowed to have a digit whose value is larger than that senior's. And no, it's not a joke, the guy really means it. That person is seriously out there.

While we're at it, try writing code that, given my order amount and that senior's order amount, determines whether he gets angry. You can probably do it, you've got this."

Problem Statement

We say that $B$ is a subset of $A$ in base ten if, at every digit in base ten, the value of $B$ is at most that of $A$.

More strictly, it is defined as follows.

The ways to represent $A$ as $a_0\times 10^0 + a_1 \times 10^1 +\dots$ and $B$ as $b_0 \times 10^0 + b_1 \times 10^1 +\dots$ ( $0$ $\leq a_i , b_i \leq$ $9$ )

are each uniquely determined, and in these representations, $a_i \geq b_i$ holds for every non-negative integer $i$.


You are given non-negative integers $A,B$. Determine whether $B$ is a subset of $A$ in base ten.

Input

$A\ B$

Constraints

  • $0\leq A,B\leq 10^{9}$

Output

Print Yes on one line if $B$ is a subset of $A$ in base ten, and No otherwise, followed by a newline at the end.

Sample

Sample 1
Input
12 1
Output
Yes

The numbers that are subsets of $12$ in base ten are, in increasing order, $0,1,2,10,11,12$.

That is, $1$ is a subset of $12$ in base ten, so print Yes.

Sample 2
Input
100 1
Output
No

The numbers that are subsets of $100$ in base ten are the $2$ numbers $0,100$.

That is, $1$ is not a subset of $100$ in base ten.

Sample 3
Input
987654321 987654321
Output
Yes

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。