P27849 [洛谷] [Information and Future 2023] Lucky Numbers
普及-
题目描述

Problem Description

If the sum of the digits at odd positions and the sum of the digits at even positions in the decimal representation of a number are the same, Xiaoxiao considers it a lucky number. For example:

  • For $12345$, the sum of digits at odd positions is $1 + 3 + 5 = 9$ and at even positions is $2 + 4 = 6$, so $12345$ is not a lucky number.

  • For $2332$, the sum of digits at odd positions is $2 + 3 = 5$ and at even positions is $3 + 2 = 5$, so $2332$ is a lucky number.

Given $a$ and $b$, Xiaoxiao wants you to find the number of lucky numbers in the range $a, a + 1, a + 2, \dots, b$.

Input Format

The input consists of a single line containing two integers $a$ and $b$ separated by a space.

Output Format

Output a single integer representing the number of lucky numbers in the range $a, a + 1, a + 2, \dots, b$.

Sample Input and Output

Sample Input #1

1 100

Sample Output #1

9

Sample Input #2

4096 65536

Sample Output #2

3454

Notes

  • For $100\%$ of the data, it is guaranteed that $1 \leq a \leq b \leq 10^6$.

This problem originally had a full score of $10\text{pts}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 100
样例输出
9