#P2088. ACSL 2022-2023 Intermediate Division Contest #1 Next Base
ACSL 2022-2023 Intermediate Division Contest #1 Next Base
PROBLEM DESCRIPTION
Given positive integers, , , and , generate the next numbers in base starting with in the given base. We guarantee that the base will be between and inclusive. We guarantee that is a valid number in base . Find the base value for the number of times the largest possible digit in the given base is found among all of the digits in the numbers generated.
INPUT FORMAT
There will be three integers representing the number of values to be found, the base to be used between and inclusive, and the starting value in the base given that will be no more than digits.
OUTPUT FORMAT
For each set of input values, output a base number representing the number of times the largest digit in the inputted base occurs in the sequence of numbers generated.
SAMPLE
INPUT #1
15 8 2
OUTPUT #1
2
INPUT #2
20 3 12
OUTPUT #2
21
INPUT #3
25 5 324
OUTPUT #3
24
INPUT #4
13 9 1652
OUTPUT #4
1
INPUT #5
45 2 1111011
OUTPUT #5
170
EXPLANATION
Sample #1 Explanation
If , , and , the numbers generated are $2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20$. The largest possible digit in base is which occurs times.