1499: CF86 - A. Reflection
[Creator : ]
Description
For each positive integernconsider the integer $\Psi(n)$ which is obtained fromnby replacing every digitain the decimal notation of $n$ with the digit (9-a). We say that $\Psi(n)$ is thereflection 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$.
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).
Your task is to find the maximum weight of the numbers in the given range $[l,r]$ (boundaries are included).
Input
Input contains two space-separated integers $l, r\ (1≤l≤r≤10^9)$ − bounds of the range.
Output
Output should contain single integer number: maximum value of the product $n \cdot \Psi(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).
Sample 1 Input
3 7
Sample 1 Output
20
Sample 2 Input
1 1
Sample 2 Output
8
Sample 3 Input
8 10
Sample 3 Output
890
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.
HINT
CF86。