#B3907. Count Special Numbers
Count Special Numbers
Count Special Numbers
Problem Description
Given two positive integers \(N\) and \(K\), count the number of positive integers \(x\) satisfying the following conditions:
- \(1 \le x \le N^N\).
- The remainder \(x \bmod K\) is a multiple of \(N\) (i.e. divisible by \(N\)).
- The last digit of \(x\) is \(N\) (that is, \(x \bmod 10 = N\)).
Here, \(x \bmod K\) denotes the remainder when \(x\) is divided by \(K\). Note that \(N^N\) stands for \(N\) raised to the power of \(N\), and all formulas are expressed in LaTeX format.
inputFormat
The input consists of a single line containing two integers \(N\) and \(K\), separated by a space.
Note: \(N\) is expected to be a single-digit positive integer so that the condition "the last digit of \(x\) is \(N\)" makes sense.
outputFormat
Output a single integer representing the number of positive integers \(x\) that satisfy all the conditions.
sample
1 1
1