{"problem":{"name":"A. Reflection","description":{"content":"For each positive integer _n_ consider the integer ψ(_n_) which is obtained from _n_ by replacing every digit _a_ in the decimal notation of _n_ with the digit (9  -  _a_). We say that ψ(_n_) is the _","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF86A"},"statements":[{"statement_type":"Markdown","content":"For each positive integer _n_ consider the integer ψ(_n_) which is obtained from _n_ by replacing every digit _a_ in the decimal notation of _n_ with the digit (9  -  _a_). We say that ψ(_n_) is the _reflection_ of _n_. For example, reflection of 192 equals 807. Note that leading zeros (if any) should be omitted. So reflection of 9 equals 0, reflection of 91 equals 8.\n\nLet us call the _weight_ of the number the product of the number and its reflection. Thus, the weight of the number 10 is equal to 10·89 = 890.\n\nYour task is to find the maximum weight of the numbers in the given range \\[_l_, _r_\\] (boundaries are included).\n\n## Input\n\nInput contains two space-separated integers _l_ and _r_ (1 ≤ _l_ ≤ _r_ ≤ 109) — bounds of the range.\n\n## Output\n\nOutput should contain single integer number: maximum value of the product _n_·ψ(_n_), where _l_ ≤ _n_ ≤ _r_.\n\nPlease, do not use _%lld_ specificator to read or write 64-bit integers in C++. It is preferred to use _cout_ (also you may use _%I64d_).\n\n[samples]\n\n## Note\n\nIn the third sample weight of 8 equals 8·1 = 8, weight of 9 equals 9·0 = 0, weight of 10 equals 890.\n\nThus, maximum value of the product is equal to 890.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"对于每个正整数 $n$，考虑整数 $\\psi(n)$，它通过将 $n$ 的十进制表示中的每一位数字 $a$ 替换为数字 $(9 - a)$ 得到。我们称 $\\psi(n)$ 为 $n$ 的 _反射_。例如，$192$ 的反射等于 $807$。注意，前导零（如果有）应被省略。因此，$9$ 的反射等于 $0$，$91$ 的反射等于 $8$。\n\n我们称一个数的 _权重_ 为该数与其反射的乘积。因此，数 $10$ 的权重等于 $10 \\cdot 89 = 890$。\n\n你的任务是找出给定范围 $[l, r]$（包含端点）内所有数的最大权重。\n\n输入包含两个用空格分隔的整数 $l$ 和 $r$（$1 \\leq l \\leq r \\leq 10^9$）——范围的边界。\n\n输出应包含一个整数：最大乘积 $n \\cdot \\psi(n)$ 的值，其中 $l \\leq n \\leq r$。\n\n请不要在 C++ 中使用 _%lld_ 标识符读取或写入 64 位整数。建议使用 _cout_（你也可以使用 _%I64d_）。\n\n## Input\n\n输入包含两个用空格分隔的整数 $l$ 和 $r$（$1 \\leq l \\leq r \\leq 10^9$）——范围的边界。\n\n## Output\n\n输出应包含一个整数：最大乘积 $n \\cdot \\psi(n)$ 的值，其中 $l \\leq n \\leq r$。请不要在 C++ 中使用 _%lld_ 标识符读取或写入 64 位整数。建议使用 _cout_（你也可以使用 _%I64d_）。\n\n[samples]\n\n## Note\n\n在第三个样例中，$8$ 的权重等于 $8 \\cdot 1 = 8$，$9$ 的权重等于 $9 \\cdot 0 = 0$，$10$ 的权重等于 $890$。因此，乘积的最大值等于 $890$。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $\\psi(n)$ denote the reflection of a positive integer $n$, obtained by replacing each digit $a$ in the decimal representation of $n$ with $9 - a$, and removing leading zeros.  \nLet $w(n) = n \\cdot \\psi(n)$ denote the weight of $n$.\n\n**Constraints**  \nGiven integers $l, r \\in \\mathbb{Z}$ such that $1 \\leq l \\leq r \\leq 10^9$.\n\n**Objective**  \nFind  \n$$\n\\max_{n \\in [l, r]} w(n) = \\max_{n \\in [l, r]} \\left( n \\cdot \\psi(n) \\right)\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF86A","tags":["math"],"sample_group":[["3 7","20"],["1 1","8"],["8 10","890"]],"created_at":"2026-03-03 11:00:39"}}