30
以n为底的数字的ASCII艺术解压缩
这是受Magic Octupus Urn的05AB1E答案的启发。 给定两个参数,一个正整数和一个字符串/字符列表: 将数字转换为base-n,其中n是字符串的长度。 对于每个字符,用该字符替换基数为n的该字符索引的所有出现。 打印或返回新字符串。 例子: Input: 2740, ["|","_"] 2740 -> 101010110100 in base 2 -> Replace 0s with "|" and 1s with "_" Output: _|_|_|__|_|| Input: 698911, ["c","h","a","o"] 698911 -> 2222220133 in base 4 -> Replace 0s with "c", 1s with "h", 2s with "a", and 3s …