Problem Description
Loading...
Problem Analysis
A base conversion problem
A bit of a hassle
Mainly because it involves digits beyond base 10
You need to output them as
10-A 11-B 12-C 13-D 14 E 15 F
in that style
But once you’ve got the basic idea of storing digits in an array
it’s still fairly easy to solve
cpp
| |
======20160531 Addendum======
Solved with Recursion
the process of dividing by k, taking the remainder, and outputting in reverse order
(the mechanism of a recursive function is to finish running the nested call first)
(that is, depth first)
plus a character array to hold the mapping
this makes the code very concise
cpp
| |