#AJ2201. 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 will be between 2 and 9 inclusive. We guarantee that is a valid number in base . Find the base 10 sum of 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. We guarantee that the will be between 2 and 9 inclusive.
Output Format
For each set of 3 input values, output a base 10 number representing the sum of all of the digits generated.
Explanation
If , , and , the base 8 numbers generated are 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20. The base 10 sum of all of their digits is 65.
15 8 2
65
20 3 12
64
25 5 324
189
13 9 1652
212
45 2 1111011
170
Related
In following homework: