#P12163. Counting Numbers That Can Form 2025

    ID: 14265 Type: Default 1000ms 256MiB

Counting Numbers That Can Form 2025

Counting Numbers That Can Form 2025

Given the range from 1 to 20250412, count how many numbers have the following property: by rearranging their digits, the resulting number contains the contiguous substring 20252025.

Note: A number can be rearranged to contain 2025 if and only if its digit multiset contains at least one 0, at least two 2’s, and at least one 5. For example, 5220 and 21520 satisfy the condition, whereas 205, 225, 2200, and 222555111 do not.

inputFormat

This problem has no input. The range is fixed from 1 to 20250412.

outputFormat

Output a single integer – the count of numbers in the range [1, 20250412] that satisfy the condition.

sample

dummy
764343