A. Life Without Zeros

Codeforces
IDCF75A
Time2000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
Can you imagine our life if we removed all zeros from it? For sure we will have many problems. In this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equation _a_ + _b_ = _c_, where _a_ and _b_ are positive integers, and _c_ is the sum of _a_ and _b_. Now let's remove all zeros from this equation. Will the equation remain correct after removing all zeros? For example if the equation is 101 + 102 = 203, if we removed all zeros it will be 11 + 12 = 23 which is still a correct equation. But if the equation is 105 + 106 = 211, if we removed all zeros it will be 15 + 16 = 211 which is not a correct equation. ## Input The input will consist of two lines, the first line will contain the integer _a_, and the second line will contain the integer _b_ which are in the equation as described above (1 ≤ _a_, _b_ ≤ 109). There won't be any leading zeros in both. The value of _c_ should be calculated as _c_ = _a_ + _b_. ## Output The output will be just one line, you should print "_YES_" if the equation will remain correct after removing all zeros, and print "_NO_" otherwise. [samples]
你能想象如果我们从生活中移除所有的零,生活会变成什么样吗?毫无疑问,我们会遇到许多问题。 在这个问题中,我们将通过一个简单的例子来说明:如果我们从生活中移除所有零,那就是加法运算。假设你被给定一个方程 $a + b = c$,其中 $a$ 和 $b$ 是正整数,$c$ 是 $a$ 和 $b$ 的和。现在让我们从这个方程中移除所有的零。移除所有零后,方程仍然正确吗? 例如,如果方程是 $101 + 102 = 203$,移除所有零后变为 $11 + 12 = 23$,这仍然是一个正确的方程。 但如果方程是 $105 + 106 = 211$,移除所有零后变为 $15 + 16 = 211$,这就不是一个正确的方程了。 输入由两行组成,第一行包含整数 $a$,第二行包含整数 $b$,它们如上所述出现在方程中($1 ≤ a, b ≤ 10^9$)。两者均无前导零。$c$ 的值应计算为 $c = a + b$。 输出仅一行,如果移除所有零后方程仍然正确,请打印 "_YES_",否则打印 "_NO_"。 ## Input 输入由两行组成,第一行包含整数 $a$,第二行包含整数 $b$,它们如上所述出现在方程中($1 ≤ a, b ≤ 10^9$)。两者均无前导零。$c$ 的值应计算为 $c = a + b$。 ## Output 输出仅一行,如果移除所有零后方程仍然正确,请打印 "_YES_",否则打印 "_NO_"。 [samples]
**Definitions** Let $ a, b \in \mathbb{Z}^+ $ with $ 1 \leq a, b \leq 10^9 $. Let $ c = a + b $. Let $ f(n) $ denote the integer formed by removing all digit '0' from the decimal representation of $ n $, for $ n \in \mathbb{Z}^+ $. **Constraints** 1. $ 1 \leq a, b \leq 10^9 $ 2. $ a $ and $ b $ have no leading zeros. **Objective** Determine whether: $$ f(a) + f(b) = f(c) $$ Output "YES" if true, "NO" otherwise.
Samples
Input #1
101
102
Output #1
YES
Input #2
105
106
Output #2
NO
API Response (JSON)
{
  "problem": {
    "name": "A. Life Without Zeros",
    "description": {
      "content": "Can you imagine our life if we removed all zeros from it? For sure we will have many problems. In this problem we will have a simple example if we removed all zeros from our life, it's the addition o",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF75A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Can you imagine our life if we removed all zeros from it? For sure we will have many problems.\n\nIn this problem we will have a simple example if we removed all zeros from our life, it's the addition o...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "你能想象如果我们从生活中移除所有的零,生活会变成什么样吗?毫无疑问,我们会遇到许多问题。\n\n在这个问题中,我们将通过一个简单的例子来说明:如果我们从生活中移除所有零,那就是加法运算。假设你被给定一个方程 $a + b = c$,其中 $a$ 和 $b$ 是正整数,$c$ 是 $a$ 和 $b$ 的和。现在让我们从这个方程中移除所有的零。移除所有零后,方程仍然正确吗?\n\n例如,如果方程是 $101 ...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ a, b \\in \\mathbb{Z}^+ $ with $ 1 \\leq a, b \\leq 10^9 $.  \nLet $ c = a + b $.  \nLet $ f(n) $ denote the integer formed by removing all digit '0' from the decimal representation ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments