CF86A.Reflection

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

For each positive integer nn consider the integer ψ(n)ψ(n) which is obtained from nn by replacing every digit aa in the decimal notation of nn with the digit (9a)(9-a) . We say that ψ(n)ψ(n) is the reflection of nn . For example, reflection of 192192 equals 807807 . Note that leading zeros (if any) should be omitted. So reflection of 99 equals 00 , reflection of 9191 equals 88 .

Let us call the weight of the number the product of the number and its reflection. Thus, the weight of the number 1010 is equal to 1089=89010·89=890 .

Your task is to find the maximum weight of the numbers in the given range [l,r][l,r] (boundaries are included).

输入格式

Input contains two space-separated integers ll and rr ( 1<=l<=r<=1091<=l<=r<=10^{9} ) — bounds of the range.

输出格式

Output should contain single integer number: maximum value of the product nψ(n)n·ψ(n) , where l<=n<=rl<=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).

输入输出样例

  • 输入#1

    3 7
    

    输出#1

    20
  • 输入#2

    1 1
    

    输出#2

    8
  • 输入#3

    8 10
    

    输出#3

    890

说明/提示

In the third sample weight of 88 equals 81=88·1=8 , weight of 99 equals 90=09·0=0 , weight of 1010 equals 890890 .

Thus, maximum value of the product is equal to 890890 .

首页