#AI2201. Next Base(中级)
Next Base(中级)
Description
Given 3 positive integers, , , and , generate the next numbers in base starting with in the given base. We guarantee that the base will be between 2 and 9 inclusive. We guarantee that is a valid number in base . Find the base 10 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 2 and 9 inclusive, and the starting value () in the base given which will be no longer than 16 digits.
Output Format
For each set of 3 input values, output a base 10 number representing the number of times the largest digit in the inputted base occurs in the sequence of numbers generated.
Explanation
Example: If : The base 8 numbers generated are 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20. The largest possible digit in base 8 is 7. 7 occurs 2 times (once in the number 7, and once in the number 17).
15 8 2
2
20 3 12
21
25 5 324
24
13 9 1652
1
45 2 1111011
170