258. Almost Lucky Numbers
time limit per test: 0.25
sec.
memory limit per test: 65536
KB
input: standard
output: standard
The number is called lucky if it consists of 2N digits and the sum of the first N digits is equal to the sum of the last N digits. The number is called almost lucky, if it is possible to change one of its digits to some other in such a way, that a new number is lucky. Your task is to find the count of almost lucky numbers in the interval from A to B (including A and B).
The first digit can't be changed to zero because of leading zeroes are not allowed.
Input
The only line of the input file contains two integer numbers A and B (0 <= A <= B <= 10^9).
Output
Output the only number  the requested number of almost lucky numbers.
Sample test(s)
Input
1 99
Output
81
Note
All twodigits not lucky numbers are almost lucky.
Author:  Andrew V. Lazarev

Resource:  Saratov SU Contest: Golden Fall 2004

Date:  October 2, 2004

Server time: 20180619 10:37:06  Online Contester Team © 2002  2016. All rights reserved. 

