#P9092. Potyczkow Numbers

    ID: 22251 Type: Default 1000ms 256MiB

Potyczkow Numbers

Potyczkow Numbers

Problem Statement:

Inspired by the work of the Russian mathematician Vladimir Potyczkow, a Potyczkow Number is defined as a positive integer that is divisible by every digit that appears in its decimal representation. Note that the decimal representation must not contain the digit zero. For example, \(48\), \(1\) and \(112\) are Potyczkow Numbers, whereas \(23\), \(10\) and \(121\) are not.

You are given two integers \(l\) and \(r\). Your task is to count how many Potyczkow Numbers exist in the inclusive range \([l, r]\).

Input Constraints: \(l\) and \(r\) are positive integers satisfying \(l \le r\).

This problem is translated from PA 2020 and originally appeared as a trial round problem: Liczba Potyczkowa.

inputFormat

The input consists of a single line containing two integers \(l\) and \(r\) separated by space, representing the inclusive range within which to count the Potyczkow Numbers.

outputFormat

Output a single integer, which is the count of Potyczkow Numbers in the range \([l, r]\).

sample

1 10
9