258. Almost Lucky Numbers
time limit per test: 0.25
memory limit per test: 65536
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.
The only line of the input file contains two integer numbers A and B (0 <= A <= B <= 10^9).
Output the only number - the requested number of almost lucky numbers.
All two-digits not lucky numbers are almost lucky.
|Author:||Andrew V. Lazarev
|Resource:||Saratov SU Contest: Golden Fall 2004
|Date:||October 2, 2004
|Server time: 2017-09-25 22:40:48||Online Contester Team © 2002 - 2016. All rights reserved.|