#P8599. Unique Digit Mixed Fraction Representations
Unique Digit Mixed Fraction Representations
Unique Digit Mixed Fraction Representations
Given a positive integer \(N\), we say that a mixed fraction representation of \(N\) is an expression of the form
\[ N = A + \frac{B}{C} \]
where \(A\), \(B\), and \(C\) are positive integers satisfying the equation \[ B = C \times (N - A), \] and when the decimal representations of \(A\), \(B\) and \(C\) are concatenated (in that order) they contain each of the digits 1 through 9 exactly once (zero is not allowed).
For example, when \(N=100\), one valid representation is \[ 100 = 3 + \frac{69258}{714}, \] since \(3\), \(69258\) and \(714\) together use every digit from 1 to 9 exactly once. Another example is \[ 100 = 82 + \frac{3546}{197}. \] It turns out that for \(N=100\) there are 11 such representations.
Your task is to write a program that, given \(N\), computes the number of valid mixed fraction representations satisfying the above conditions.
inputFormat
The input consists of a single positive integer \(N\) on one line.
outputFormat
Output a single integer representing the number of valid representations of \(N\) as described above.
sample
100
11