#B4131. Counting Valid License Plates

    ID: 11788 Type: Default 1000ms 256MiB

Counting Valid License Plates

Counting Valid License Plates

A license plate is defined as an $8$-digit number (including leading zeros), ranging from $00000000$ to $99999999$. A recent incident has left the police with three clues provided by witnesses:

  • Witness A: The first $4$ digits form a consecutive increasing sequence (e.g. $0123$, $1234$, ..., $6789$).
  • Witness B: The last $4$ digits also form a consecutive increasing sequence.
  • Witness C: The sum of all digits is a perfect square, i.e. it can be written in the form $k^2$ for some integer $k$.

For example, the license plate 01231234 meets the criteria because both 0123 and 1234 are consecutive sequences and the digit sum is $0+1+2+3+1+2+3+4=16$, which is $4^2$.

Your task is to count all license plates that satisfy these conditions.

inputFormat

No input is required for this problem.

outputFormat

Output a single integer representing the total number of valid license plates that meet the given conditions.

sample

9