#P1179. [NOIP 2010 普及组] 数字统计

[NOIP 2010 普及组] 数字统计

Description

Count how many times the digit 22 appears among all integers in the given range [L,R][L, R].

For example, for the range [2,22][2, 22], the digit 22 appears 1 time in the number 2, 1 time in 12, 1 time in 20, 1 time in 21, and 2 times in 22, so the digit 22 appears a total of 6 times in this range.

Input Format

22 positive integers LL and RR, separated by a space.

Output Format

The number of occurrences of digit 22.

2 22

6

2 100
20

Hint

Constraints: 1LR1000001 ≤ L ≤ R ≤ 100000.

NOIP 2010 Junior Problem 1.

Translated by ChatGPT 5