A. Quasi-palindrome

Codeforces
IDCF863A
Time1000ms
Memory256MB
Difficulty
brute forceimplementation
English · Original
Chinese · Translation
Formal · Original
Let _quasi-palindromic_ number be such number that adding some leading zeros (possible none) to it produces a palindromic string. String _t_ is called a palindrome, if it reads the same from left to right and from right to left. For example, numbers 131 and 2010200 are _quasi-palindromic_, they can be transformed to strings "131" and "002010200", respectively, which are palindromes. You are given some integer number _x_. Check if it's a _quasi-palindromic_ number. ## Input The first line contains one integer number _x_ (1 ≤ _x_ ≤ 109). This number is given without any leading zeroes. ## Output Print "_YES_" if number _x_ is _quasi-palindromic_. Otherwise, print "_NO_" (without quotes). [samples]
定义一个 _quasi-palindromic_ 数为:通过添加若干前导零(可能不添加)后,可以变为回文字符串的数。 字符串 #cf_span[t] 被称为回文,如果它从左到右读和从右到左读是一样的。 例如,数字 #cf_span[131] 和 #cf_span[2010200] 是 _quasi-palindromic_ 数,它们可以分别变为字符串 "#cf_span[131]" 和 "#cf_span[002010200]",这两个都是回文。 给你一个整数 #cf_span[x],判断它是否是 _quasi-palindromic_ 数。 第一行包含一个整数 #cf_span[x](#cf_span[1 ≤ x ≤ 10^9])。这个数以没有前导零的形式给出。 如果 #cf_span[x] 是 _quasi-palindromic_ 数,则输出 "_YES_";否则输出 "_NO_"(不包含引号)。 ## Input 第一行包含一个整数 #cf_span[x](#cf_span[1 ≤ x ≤ 10^9])。这个数以没有前导零的形式给出。 ## Output 如果 #cf_span[x] 是 _quasi-palindromic_ 数,则输出 "_YES_";否则输出 "_NO_"(不包含引号)。 [samples]
**Definitions** Let $ x \in \mathbb{Z} $ be a positive integer with $ 1 \leq x \leq 10^9 $, represented in base-10 without leading zeros. Let $ s \in \{0,1,\dots,9\}^* $ be the decimal string representation of $ x $ (no leading zeros). **Constraints** - $ s $ contains no leading zeros. - $ 1 \leq |s| \leq 10 $. **Objective** Determine whether there exists a string $ s' \in \{0,1,\dots,9\}^* $ such that: - $ s' = 0^k \cdot s $ for some $ k \geq 0 $, - $ s' $ is a palindrome (i.e., $ s' = \text{reverse}(s') $). Output "YES" if such $ s' $ exists; otherwise, output "NO".
Samples
Input #1
131
Output #1
YES
Input #2
320
Output #2
NO
Input #3
2010200
Output #3
YES
API Response (JSON)
{
  "problem": {
    "name": "A. Quasi-palindrome",
    "description": {
      "content": "Let _quasi-palindromic_ number be such number that adding some leading zeros (possible none) to it produces a palindromic string. String _t_ is called a palindrome, if it reads the same from left to ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF863A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Let _quasi-palindromic_ number be such number that adding some leading zeros (possible none) to it produces a palindromic string.\n\nString _t_ is called a palindrome, if it reads the same from left to ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "定义一个 _quasi-palindromic_ 数为:通过添加若干前导零(可能不添加)后,可以变为回文字符串的数。\n\n字符串 #cf_span[t] 被称为回文,如果它从左到右读和从右到左读是一样的。\n\n例如,数字 #cf_span[131] 和 #cf_span[2010200] 是 _quasi-palindromic_ 数,它们可以分别变为字符串 \"#cf_span[131]\" 和 \"#c...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ x \\in \\mathbb{Z} $ be a positive integer with $ 1 \\leq x \\leq 10^9 $, represented in base-10 without leading zeros.  \nLet $ s \\in \\{0,1,\\dots,9\\}^* $ be the decimal string repr...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments