A8081 | Reflection
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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$ .
Let 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$ .
Your task is to find the maximum weight of the numbers in the given range $[l,r]$ (boundaries are included).
Let 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$ .
Your task is to find the maximum weight of the numbers in the given range $[l,r]$ (boundaries are included).
输入格式
Input contains two space-separated integers $l$ and $r$ ( $1<=l<=r<=10^{9}$ ) — bounds of the range.
输出格式
Output should contain single integer number: maximum value of the product $n·ψ(n)$ , where $l<=n<=r$ .
Please, 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).
Please, 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).
输入输出样例
输入 #1
3 7
输出 #1
20
输入 #2
1 1
输出 #2
8
输入 #3
8 10
输出 #3
890
In the third sample weight of $8$ equals $8·1=8$ , weight of $9$ equals $9·0=0$ , weight of $10$ equals $890$ .
Thus, maximum value of the product is equal to $890$ .
Thus, maximum value of the product is equal to $890$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted