UVa 11005
Jump to navigation
Jump to search
11005 - Cheapest Base[edit]
Summary[edit]
This is a simple problem of converting a number from base 10 to each of of the bases from 2 to 36.
Explanation[edit]
Naive method works in this problem. Convert the given number from base 10 to another base, and then sum up the values of the digit, and then find the minimum of that.
Input[edit]
2 10 8 12 13 15 13 13 16 9 11 18 24 21 23 23 23 13 15 17 33 21 23 27 26 27 19 4 22 18 30 30 24 16 26 21 21 5 98329921 12345 800348 14 873645 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 0 1 10 100
Output[edit]
Case 1: Cheapest base(s) for number 98329921: 24 Cheapest base(s) for number 12345: 13 31 Cheapest base(s) for number 800348: 31 Cheapest base(s) for number 14: 13 Cheapest base(s) for number 873645: 22 Case 2: Cheapest base(s) for number 0: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Cheapest base(s) for number 1: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Cheapest base(s) for number 10: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Cheapest base(s) for number 100: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36