#P4124. [CQOI2016] 手机号码

    ID: 3209 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp2016重庆各省省选数位 dp概率论,统计

[CQOI2016] 手机号码

Description

People prefer mobile phone numbers that are easy to remember or considered lucky. For example, numbers that contain several adjacent identical digits, or numbers that avoid digits with inauspicious homophones. Mobile operators also consider these factors when issuing new numbers and may select numbers with certain features from a number range to sell separately. To aid planning, the operator wants a tool to automatically count how many numbers in a range satisfy certain features.

The tool checks two features: the number must contain at least 33 consecutive identical digits; the number must not contain both 88 and 44 at the same time. A number is valid only if it satisfies both features. Examples that satisfy the conditions: 13000988721, 23333333333, 14444101000. Examples that do not satisfy the conditions: 1015400080, 10010012022.

A mobile phone number has exactly 1111 digits and does not have a leading 00. The tool receives two numbers LL and RR and automatically counts how many numbers in the interval [L,R][L,R] satisfy the conditions. LL and RR are also 1111-digit mobile phone numbers.

Input Format

The input contains a single line with 22 positive integers L,RL,R separated by a space.

Output Format

Output a single line with 11 integer, the number of valid mobile phone numbers.

12121284000 12121285550
5

Hint

Sample explanation: valid numbers are 12121285000, 12121285111, 12121285222, 12121285333, 12121285550.

Constraints: 1010LR<101110^{10}\leq L\leq R<10^{11}.

Translated by ChatGPT 5