#P2657. [SCOI2009] windy 数

    ID: 1670 远端评测题 1000ms 125MiB 尝试: 1 已通过: 1 难度: 5 上传者: 标签>动态规划,dp2009四川各省省选数位 dp

[SCOI2009] windy 数

Description

A positive integer without leading zeros, where the absolute difference between every pair of adjacent digits is at least 22, is called a windy number. Windy wants to know: between aa and bb, inclusive, how many windy numbers are there?

Input Format

The input contains a single line with two integers, representing aa and bb.

Output Format

Output a single line with one integer, the answer.

1 10
9
25 50

20

Hint

Constraints

For all test points, it is guaranteed that 1ab2×1091 \leq a \leq b \leq 2 \times 10^9.

Translated by ChatGPT 5