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.
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.
Andrew V. Lazarev
Saratov SU Contest: Golden Fall 2004
October 2, 2004
Codeforces (c) Copyright 2010-2020 Mike Mirzayanov